Changeset dc7db63 for src/Parser/lex.ll
- Timestamp:
- Mar 22, 2018, 4:41:01 PM (6 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:
- 6ecc079
- Parents:
- 41624f92
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/lex.ll
r41624f92 rdc7db63 10 10 * Created On : Sat Sep 22 08:58:10 2001 11 11 * Last Modified By : Peter A. Buhr 12 * Last Modified On : Sat Mar 3 18:38:16 201813 * Update Count : 6 4012 * Last Modified On : Thu Mar 22 14:14:46 2018 13 * Update Count : 667 14 14 */ 15 15 … … 57 57 yyleng = 0; 58 58 for ( int i = 0; yytext[i] != '\0'; i += 1 ) { 59 if ( yytext[i] == '`' ) {60 // copy user suffix61 for ( ; yytext[i] != '\0'; i += 1 ) {62 yytext[yyleng] = yytext[i];63 yyleng += 1;64 } // for65 break;66 } // if67 59 if ( yytext[i] != '_' ) { 68 60 yytext[yyleng] = yytext[i]; … … 90 82 attr_identifier "@"{identifier} 91 83 92 user_suffix_opt ("`"{identifier})?93 94 84 // numeric constants, CFA: '_' in constant 95 85 hex_quad {hex}("_"?{hex}){3} 96 86 size_opt (8|16|32|64|128)? 97 87 length ("ll"|"LL"|[lL]{size_opt})|("hh"|"HH"|[hH]) 98 integer_suffix_opt ("_"?(([uU]({length}?[iI]?)|([iI]{length}))|([iI]({length}?[uU]?)|([uU]{length}))|({length}([iI]?[uU]?)|([uU][iI]))|[zZ]))? {user_suffix_opt}88 integer_suffix_opt ("_"?(([uU]({length}?[iI]?)|([iI]{length}))|([iI]({length}?[uU]?)|([uU]{length}))|({length}([iI]?[uU]?)|([uU][iI]))|[zZ]))? 99 89 100 90 octal_digits ({octal})|({octal}({octal}|"_")*{octal}) … … 118 108 floating_length ([fFdDlL]|[lL]{floating_size}) 119 109 floating_suffix ({floating_length}?[iI]?)|([iI]{floating_length}) 120 floating_suffix_opt ("_"?({floating_suffix}|"DL"))? {user_suffix_opt}110 floating_suffix_opt ("_"?({floating_suffix}|"DL"))? 121 111 decimal_digits ({decimal})|({decimal}({decimal}|"_")*{decimal}) 122 112 floating_decimal {decimal_digits}"."{exponent}?{floating_suffix_opt} … … 125 115 126 116 binary_exponent "_"?[pP]"_"?[+-]?{decimal_digits} 127 hex_floating_suffix_opt ("_"?({floating_suffix}))? {user_suffix_opt}117 hex_floating_suffix_opt ("_"?({floating_suffix}))? 128 118 hex_floating_fraction ({hex_digits}?"."{hex_digits})|({hex_digits}".") 129 119 hex_floating_constant {hex_prefix}(({hex_floating_fraction}{binary_exponent})|({hex_digits}{binary_exponent})){hex_floating_suffix_opt} … … 314 304 /* identifier */ 315 305 {identifier} { IDENTIFIER_RETURN(); } 306 "`"{identifier}"`" { 307 yytext[yyleng - 1] = '\0'; yytext += 1; // remove backquotes (ok to shorten) 308 IDENTIFIER_RETURN(); 309 } 316 310 {attr_identifier} { ATTRIBUTE_RETURN(); } 317 "`" { BEGIN BKQUOTE; }318 <BKQUOTE>{identifier} { IDENTIFIER_RETURN(); }319 <BKQUOTE>"`" { BEGIN 0; }320 311 321 312 /* numeric constants */ … … 332 323 ({cwide_prefix}[_]?)?['] { BEGIN QUOTE; rm_underscore(); strtext = new string( yytext, yyleng ); } 333 324 <QUOTE>[^'\\\n]* { strtext->append( yytext, yyleng ); } 334 <QUOTE>['\n] {user_suffix_opt}{ BEGIN 0; strtext->append( yytext, yyleng ); RETURN_STR(CHARACTERconstant); }325 <QUOTE>['\n] { BEGIN 0; strtext->append( yytext, yyleng ); RETURN_STR(CHARACTERconstant); } 335 326 /* ' stop editor highlighting */ 336 327 … … 338 329 ({swide_prefix}[_]?)?["] { BEGIN STRING; rm_underscore(); strtext = new string( yytext, yyleng ); } 339 330 <STRING>[^"\\\n]* { strtext->append( yytext, yyleng ); } 340 <STRING>["\n] {user_suffix_opt}{ BEGIN 0; strtext->append( yytext, yyleng ); RETURN_STR(STRINGliteral); }331 <STRING>["\n] { BEGIN 0; strtext->append( yytext, yyleng ); RETURN_STR(STRINGliteral); } 341 332 /* " stop editor highlighting */ 342 333 … … 348 339 /* punctuation */ 349 340 "@" { ASCIIOP_RETURN(); } 341 "`" { ASCIIOP_RETURN(); } 350 342 "[" { ASCIIOP_RETURN(); } 351 343 "]" { ASCIIOP_RETURN(); }
Note: See TracChangeset
for help on using the changeset viewer.