Changeset 2ae16219 for tools/prettyprinter/lex.ll
- Timestamp:
- Apr 19, 2018, 11:04:47 AM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, with_gc
- Children:
- c28bcc7
- Parents:
- b2da0574 (diff), 61323a7 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 edited
-
tools/prettyprinter/lex.ll (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tools/prettyprinter/lex.ll
rb2da0574 r2ae16219 10 10 * Created On : Sat Dec 15 11:45:59 2001 11 11 * Last Modified By : Peter A. Buhr 12 * Last Modified On : Tue Aug 29 17:33:36 201713 * Update Count : 2 6812 * Last Modified On : Sun Apr 15 21:28:33 2018 13 * Update Count : 271 14 14 */ 15 15 … … 50 50 <INITIAL,C_CODE>"/*" { // C style comments */ 51 51 #if defined(DEBUG_ALL) | defined(DEBUG_COMMENT) 52 cerr << "\"/*\" : " << yytext << endl;52 cerr << "\"/*\" : " << yytext << endl; 53 53 #endif 54 if ( YYSTATE == C_CODE ) code_str += yytext;55 else comment_str += yytext;56 yy_push_state(C_COMMENT);54 if ( YYSTATE == C_CODE ) code_str += yytext; 55 else comment_str += yytext; 56 yy_push_state(C_COMMENT); 57 57 } 58 58 <C_COMMENT>(.|"\n") { // C style comments 59 59 #if defined(DEBUG_ALL) | defined(DEBUG_COMMENT) 60 cerr << "<C_COMMENT>(.|\\n) : " << yytext << endl;60 cerr << "<C_COMMENT>(.|\\n) : " << yytext << endl; 61 61 #endif 62 if ( yy_top_state() == C_CODE ) code_str += yytext;63 else comment_str += yytext;62 if ( yy_top_state() == C_CODE ) code_str += yytext; 63 else comment_str += yytext; 64 64 } 65 65 <C_COMMENT>"*/" { // C style comments … … 123 123 <C_CODE>"%}" { RETURN_TOKEN( RCURL ) } 124 124 125 ^"%union" { RETURN_TOKEN( UNION ) } 126 ^"%start" { RETURN_TOKEN( START ) } 127 ^"%token" { RETURN_TOKEN( TOKEN ) } 128 ^"%type" { RETURN_TOKEN( TYPE ) } 129 ^"%left" { RETURN_TOKEN( LEFT ) } 130 ^"%right" { RETURN_TOKEN( RIGHT ) } 131 ^"%nonassoc" { RETURN_TOKEN( NONASSOC ) } 132 ^"%precedence" { RETURN_TOKEN( PRECEDENCE ) } 125 ^"%define"[^\n]*"\n" { RETURN_TOKEN( DEFINE ) } 126 ^"%expect" { RETURN_TOKEN( EXPECT ) } 127 ^"%left" { RETURN_TOKEN( LEFT ) } 128 ^"%locations" { RETURN_TOKEN( LOCATIONS ) } 129 ^"%nonassoc" { RETURN_TOKEN( NONASSOC ) } 130 ^"%precedence" { RETURN_TOKEN( PRECEDENCE ) } 133 131 ^"%pure_parser" { RETURN_TOKEN( PURE_PARSER ) } 132 ^"%right" { RETURN_TOKEN( RIGHT ) } 134 133 ^"%semantic_parser" { RETURN_TOKEN( SEMANTIC_PARSER ) } 135 ^"%expect" { RETURN_TOKEN( EXPECT ) } 136 ^"%thong" { RETURN_TOKEN( THONG ) } 134 ^"%start" { RETURN_TOKEN( START ) } 135 ^"%thong" { RETURN_TOKEN( THONG ) } 136 ^"%token" { RETURN_TOKEN( TOKEN ) } 137 ^"%type" { RETURN_TOKEN( TYPE ) } 138 ^"%union" { RETURN_TOKEN( UNION ) } 137 139 138 "%prec" { RETURN_TOKEN( PREC ) }140 "%prec" { RETURN_TOKEN( PREC ) } 139 141 140 {integer} { RETURN_TOKEN( INTEGER ); }141 [']{c_char}['] { RETURN_TOKEN( CHARACTER ); }142 {identifier} { RETURN_TOKEN( IDENTIFIER ); }142 {integer} { RETURN_TOKEN( INTEGER ); } 143 [']{c_char}['] { RETURN_TOKEN( CHARACTER ); } 144 {identifier} { RETURN_TOKEN( IDENTIFIER ); } 143 145 144 146 <C_CODE>["]{s_char}*["] { // hide braces "{}" in strings … … 160 162 %% 161 163 void lexC(void) { 162 BEGIN(C_CODE);164 BEGIN(C_CODE); 163 165 } 164 166 165 167 string lexYacc(void) { 166 BEGIN(INITIAL);167 //cerr << "CODE: " << endl << code_str << endl;168 string temp( code_str );169 code_str = "";170 return temp;168 BEGIN(INITIAL); 169 //cerr << "CODE: " << endl << code_str << endl; 170 string temp( code_str ); 171 code_str = ""; 172 return temp; 171 173 } 172 174
Note:
See TracChangeset
for help on using the changeset viewer.