-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This looks like a large commit, but conceptually it is quite simple: …
…maketea no longer generates prefixes, so that AST::AST_node is now called AST::Node. Also fixed a (separate) bug in the XML parser/unparser, which didn't deal with CASTs properly. Did not run all tests to their completion, but BasicParseTest and XML_roundtrip are working, and I suspect that removing prefixes cannot introduce any subtle bugs (though I may be wrong :)
- Loading branch information
Showing
133 changed files
with
14,652 additions
and
14,428 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#include <AST.h> | ||
|
||
extern "C" void process_ast(AST_php_script* php_script) | ||
extern "C" void process_ast(PHP_script* php_script) | ||
{ | ||
printf("%d statement(s) found\n", php_script->statements->size()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#include <AST.h> | ||
|
||
extern "C" void process_ast(AST_php_script* php_script) | ||
extern "C" void process_ast(PHP_script* php_script) | ||
{ | ||
cout << "Hello world (I'm a phc plugin!)" << endl; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# From phc revision 907 onwards, name prefixes have been removed on classes. | ||
# For example, "AST::AST_node" is now called "AST::node" (namespaces were | ||
# introduced earlier). This script can be used to update 'legacy' code. | ||
# | ||
# Use | ||
# | ||
# perl -n -i- convert_AST_names foo.cpp | ||
# | ||
# To convert 'foo.cpp' (a backup 'foo.cpp-' will be created) | ||
s/AST_node(?!\.)/Node/g; | ||
s/AST_php_script(?!\.)/PHP_script/g; | ||
s/AST_class_mod(?!\.)/Class_mod/g; | ||
s/AST_signature(?!\.)/Signature/g; | ||
s/AST_method_mod(?!\.)/Method_mod/g; | ||
s/AST_formal_parameter(?!\.)/Formal_parameter/g; | ||
s/AST_type(?!\.)/Type/g; | ||
s/AST_attr_mod(?!\.)/Attr_mod/g; | ||
s/AST_name_with_default(?!\.)/Name_with_default/g; | ||
s/AST_directive(?!\.)/Directive/g; | ||
s/AST_list_element(?!\.)/List_element/g; | ||
s/AST_variable_name(?!\.)/Variable_name/g; | ||
s/AST_target(?!\.)/Target/g; | ||
s/AST_array_elem(?!\.)/Array_elem/g; | ||
s/AST_method_name(?!\.)/Method_name/g; | ||
s/AST_actual_parameter(?!\.)/Actual_parameter/g; | ||
s/AST_class_name(?!\.)/Class_name/g; | ||
s/AST_commented_node(?!\.)/Commented_node/g; | ||
s/AST_identifier(?!\.)/Identifier/g; | ||
s/AST_statement(?!\.)/Statement/g; | ||
s/AST_member(?!\.)/Member/g; | ||
s/AST_switch_case(?!\.)/Switch_case/g; | ||
s/AST_catch(?!\.)/Catch/g; | ||
s/AST_expr(?!\.)/Expr/g; | ||
s/AST_nested_list_elements(?!\.)/Nested_list_elements/g; | ||
s/AST_reflection(?!\.)/Reflection/g; | ||
s/Token_class_name(?!\.)/CLASS_NAME/g; | ||
s/Token_interface_name(?!\.)/INTERFACE_NAME/g; | ||
s/Token_method_name(?!\.)/METHOD_NAME/g; | ||
s/Token_variable_name(?!\.)/VARIABLE_NAME/g; | ||
s/Token_directive_name(?!\.)/DIRECTIVE_NAME/g; | ||
s/Token_label_name(?!\.)/LABEL_NAME/g; | ||
s/Token_ht_iterator(?!\.)/HT_ITERATOR/g; | ||
s/Token_op(?!\.)/OP/g; | ||
s/Token_cast(?!\.)/CAST/g; | ||
s/Token_constant_name(?!\.)/CONSTANT_NAME/g; | ||
s/AST_class_def(?!\.)/Class_def/g; | ||
s/AST_interface_def(?!\.)/Interface_def/g; | ||
s/AST_method(?!\.)/Method/g; | ||
s/AST_attribute(?!\.)/Attribute/g; | ||
s/AST_if(?!\.)/If/g; | ||
s/AST_while(?!\.)/While/g; | ||
s/AST_do(?!\.)/Do/g; | ||
s/AST_for(?!\.)/For/g; | ||
s/AST_foreach(?!\.)/Foreach/g; | ||
s/AST_switch(?!\.)/Switch/g; | ||
s/AST_break(?!\.)/Break/g; | ||
s/AST_continue(?!\.)/Continue/g; | ||
s/AST_return(?!\.)/Return/g; | ||
s/AST_static_declaration(?!\.)/Static_declaration/g; | ||
s/AST_global(?!\.)/Global/g; | ||
s/AST_declare(?!\.)/Declare/g; | ||
s/AST_try(?!\.)/Try/g; | ||
s/AST_throw(?!\.)/Throw/g; | ||
s/AST_eval_expr(?!\.)/Eval_expr/g; | ||
s/AST_nop(?!\.)/Nop/g; | ||
s/AST_branch(?!\.)/Branch/g; | ||
s/AST_goto(?!\.)/Goto/g; | ||
s/AST_label(?!\.)/Label/g; | ||
s/AST_foreach_reset(?!\.)/Foreach_reset/g; | ||
s/AST_foreach_next(?!\.)/Foreach_next/g; | ||
s/AST_foreach_end(?!\.)/Foreach_end/g; | ||
s/AST_foreach_has_key(?!\.)/Foreach_has_key/g; | ||
s/AST_foreach_get_key(?!\.)/Foreach_get_key/g; | ||
s/AST_foreach_get_data(?!\.)/Foreach_get_data/g; | ||
s/AST_literal(?!\.)/Literal/g; | ||
s/AST_assignment(?!\.)/Assignment/g; | ||
s/AST_op_assignment(?!\.)/Op_assignment/g; | ||
s/AST_list_assignment(?!\.)/List_assignment/g; | ||
s/AST_cast(?!\.)/Cast/g; | ||
s/AST_unary_op(?!\.)/Unary_op/g; | ||
s/AST_bin_op(?!\.)/Bin_op/g; | ||
s/AST_conditional_expr(?!\.)/Conditional_expr/g; | ||
s/AST_ignore_errors(?!\.)/Ignore_errors/g; | ||
s/AST_constant(?!\.)/Constant/g; | ||
s/AST_instanceof(?!\.)/Instanceof/g; | ||
s/AST_variable(?!\.)/Variable/g; | ||
s/AST_pre_op(?!\.)/Pre_op/g; | ||
s/AST_post_op(?!\.)/Post_op/g; | ||
s/AST_array(?!\.)/Array/g; | ||
s/AST_method_invocation(?!\.)/Method_invocation/g; | ||
s/AST_new(?!\.)/New/g; | ||
s/Token_int(?!\.)/INT/g; | ||
s/Token_real(?!\.)/REAL/g; | ||
s/Token_string(?!\.)/STRING/g; | ||
s/Token_bool(?!\.)/BOOL/g; | ||
s/Token_null(?!\.)/NIL/g; | ||
s/AST_transform(?!\.)/Transform/g; | ||
s/AST_visitor(?!\.)/Visitor/g; | ||
s/AST_fold(?!\.)/Fold/g; | ||
s/AST_factory(?!\.)/Node_factory/g; | ||
s/pre_null/pre_nil/g; | ||
s/post_null/post_nil/g; | ||
s/children_null/children_nil/g; | ||
print; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# From phc revision 907 onwards, name prefixes have been removed on classes. | ||
# For example, "HIR::HIR_node" is now called "HIR::node" (namespaces were | ||
# introduced earlier). This script can be used to update 'legacy' code. | ||
# | ||
# Use | ||
# | ||
# perl -n -i- convert_HIR_names foo.cpp | ||
# | ||
# To convert 'foo.cpp' (a backup 'foo.cpp-' will be created) | ||
s/HIR_node(?!\.)/Node/g; | ||
s/HIR_php_script(?!\.)/PHP_script/g; | ||
s/HIR_statement(?!\.)/Statement/g; | ||
s/HIR_class_mod(?!\.)/Class_mod/g; | ||
s/HIR_member(?!\.)/Member/g; | ||
s/HIR_signature(?!\.)/Signature/g; | ||
s/HIR_method_mod(?!\.)/Method_mod/g; | ||
s/HIR_formal_parameter(?!\.)/Formal_parameter/g; | ||
s/HIR_type(?!\.)/Type/g; | ||
s/HIR_attr_mod(?!\.)/Attr_mod/g; | ||
s/HIR_name_with_default(?!\.)/Name_with_default/g; | ||
s/HIR_catch(?!\.)/Catch/g; | ||
s/HIR_variable_name(?!\.)/Variable_name/g; | ||
s/HIR_target(?!\.)/Target/g; | ||
s/HIR_array_elem(?!\.)/Array_elem/g; | ||
s/HIR_method_name(?!\.)/Method_name/g; | ||
s/HIR_actual_parameter(?!\.)/Actual_parameter/g; | ||
s/HIR_class_name(?!\.)/Class_name/g; | ||
s/HIR_identifier(?!\.)/Identifier/g; | ||
s/HIR_class_def(?!\.)/Class_def/g; | ||
s/HIR_interface_def(?!\.)/Interface_def/g; | ||
s/HIR_method(?!\.)/Method/g; | ||
s/HIR_attribute(?!\.)/Attribute/g; | ||
s/HIR_return(?!\.)/Return/g; | ||
s/HIR_static_declaration(?!\.)/Static_declaration/g; | ||
s/HIR_global(?!\.)/Global/g; | ||
s/HIR_try(?!\.)/Try/g; | ||
s/HIR_throw(?!\.)/Throw/g; | ||
s/HIR_eval_expr(?!\.)/Eval_expr/g; | ||
s/HIR_branch(?!\.)/Branch/g; | ||
s/HIR_goto(?!\.)/Goto/g; | ||
s/HIR_label(?!\.)/Label/g; | ||
s/HIR_foreach_reset(?!\.)/Foreach_reset/g; | ||
s/HIR_foreach_next(?!\.)/Foreach_next/g; | ||
s/HIR_foreach_end(?!\.)/Foreach_end/g; | ||
s/HIR_expr(?!\.)/Expr/g; | ||
s/HIR_reflection(?!\.)/Reflection/g; | ||
s/Token_class_name(?!\.)/CLASS_NAME/g; | ||
s/Token_interface_name(?!\.)/INTERFACE_NAME/g; | ||
s/Token_method_name(?!\.)/METHOD_NAME/g; | ||
s/Token_variable_name(?!\.)/VARIABLE_NAME/g; | ||
s/Token_label_name(?!\.)/LABEL_NAME/g; | ||
s/Token_ht_iterator(?!\.)/HT_ITERATOR/g; | ||
s/Token_cast(?!\.)/CAST/g; | ||
s/Token_op(?!\.)/OP/g; | ||
s/Token_constant_name(?!\.)/CONSTANT_NAME/g; | ||
s/HIR_foreach_has_key(?!\.)/Foreach_has_key/g; | ||
s/HIR_foreach_get_key(?!\.)/Foreach_get_key/g; | ||
s/HIR_foreach_get_data(?!\.)/Foreach_get_data/g; | ||
s/HIR_literal(?!\.)/Literal/g; | ||
s/HIR_assignment(?!\.)/Assignment/g; | ||
s/HIR_cast(?!\.)/Cast/g; | ||
s/HIR_unary_op(?!\.)/Unary_op/g; | ||
s/HIR_bin_op(?!\.)/Bin_op/g; | ||
s/HIR_constant(?!\.)/Constant/g; | ||
s/HIR_instanceof(?!\.)/Instanceof/g; | ||
s/HIR_variable(?!\.)/Variable/g; | ||
s/HIR_pre_op(?!\.)/Pre_op/g; | ||
s/HIR_array(?!\.)/Array/g; | ||
s/HIR_method_invocation(?!\.)/Method_invocation/g; | ||
s/HIR_new(?!\.)/New/g; | ||
s/Token_int(?!\.)/INT/g; | ||
s/Token_real(?!\.)/REAL/g; | ||
s/Token_string(?!\.)/STRING/g; | ||
s/Token_bool(?!\.)/BOOL/g; | ||
s/Token_null(?!\.)/NIL/g; | ||
s/HIR_transform(?!\.)/Transform/g; | ||
s/HIR_visitor(?!\.)/Visitor/g; | ||
s/HIR_fold(?!\.)/Fold/g; | ||
s/HIR_factory(?!\.)/Node_factory/g; | ||
print; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.