00001 #ifndef __AST_FROM_STRING_H__ 00002 #define __AST_FROM_STRING_H__ 00003 00007 #include "sage3basic.h" 00008 #include <iostream> 00009 #include <vector> 00010 00017 namespace AstFromString 00018 { 00019 00020 //-------------------------------------------------------------- 00022 00026 00027 #define OFS_MAX_LEN 256 00028 00031 extern const char* c_char; 00032 00034 extern SgNode* c_sgnode; 00035 00037 extern SgNode* c_parsed_node; 00038 00040 00041 00043 00047 00048 bool afs_is_digit(); 00049 00051 bool afs_is_identifier_char(); 00052 00054 bool afs_is_letter(); 00055 00057 bool afs_is_lower_letter(); 00058 00060 bool afs_is_upper_letter(); 00061 00063 00065 00071 00072 bool afs_match_char(char c); 00073 00086 bool afs_match_substr(const char* substr, bool checkTrail = true); 00087 00089 bool afs_skip_whitespace(); 00090 00091 00093 bool afs_match_identifier(); 00094 00096 bool afs_match_integer_const(int * result); 00097 00099 bool afs_match_translation_unit(); 00100 00102 bool afs_match_external_declaration(); 00103 00105 bool afs_match_function_definition(); 00106 00108 bool afs_match_declaration(); 00109 00111 bool afs_match_declaration_specifiers(); 00112 00114 bool afs_match_init_declarator_list(); 00115 00117 bool afs_match_init_declarator(); 00118 00120 bool afs_match_storage_class_specifier(); 00121 00123 bool afs_match_type_specifier(); 00124 // type_id in ANTLR grammar 00125 //struct_or_union_specifier 00126 //struct_or_union 00127 //struct_declaration_list 00128 //struct_declaration 00130 bool afs_match_specifier_qualifier_list(std::vector<SgNode*> &); 00131 //struct_declarator_list 00132 //struct_declarator 00133 // enum_specifier 00134 //enumerator_list 00135 // enumerator 00137 bool afs_match_type_qualifier(); 00138 //declarator 00139 //direct_declarator 00140 // declarator_suffix 00141 // pointer 00142 //parameter_type_list 00143 // parameter_list 00144 //parameter_declaration 00145 // identifier_list 00147 bool afs_match_type_name(); 00148 //abstract_declarator 00149 //direct_abstract_declarator 00150 //abstract_declarator_suffix 00151 // initializer 00152 // initializer_list 00153 00154 00156 00159 //----------------------------------------- 00161 bool afs_match_argument_expression_list(); 00162 00164 bool afs_match_additive_expression(); 00165 00167 bool afs_match_multiplicative_expression(); 00168 00170 bool afs_match_cast_expression(); 00171 00173 bool afs_match_unary_expression(); 00174 00176 bool afs_match_postfix_expression(); 00177 00179 bool afs_match_primary_expression(); 00180 00182 bool afs_match_constant(); 00183 00185 bool afs_match_expression(); 00186 00188 bool afs_match_constant_expression(); 00189 00191 bool afs_match_assignment_expression(); 00192 00194 bool afs_match_lvalue(); 00195 // assignment_operator, included in assignment_expression in this implementation 00197 bool afs_match_conditional_expression(); 00198 00200 bool afs_match_logical_or_expression(); 00201 00203 bool afs_match_logical_and_expression(); 00204 00206 bool afs_match_inclusive_or_expression(); 00207 00209 bool afs_match_exclusive_or_expression(); 00210 00212 bool afs_match_and_expression(); 00213 00215 bool afs_match_equality_expression(); 00216 00218 bool afs_match_relational_expression(); 00219 00221 bool afs_match_shift_expression(); 00223 00224 //----------------------------------------- 00226 00229 00230 bool afs_match_statement(); 00231 00233 bool afs_match_labeled_statement(); 00235 bool afs_match_compound_statement(); 00237 bool afs_match_expression_statement(); 00239 bool afs_match_selection_statement(); 00241 bool afs_match_iteration_statement(); 00243 bool afs_match_jump_statement(); 00244 00246 } 00247 00248 #endif /* __AST_FROM_STRING_H__ */
1.4.7