-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathconvert_AST_names.pl
104 lines (104 loc) · 3.52 KB
/
convert_AST_names.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
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;