Changes in src/Parser/lex.ll [7e419e7:0a2168f]
- File:
-
- 1 edited
-
src/Parser/lex.ll (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/lex.ll
r7e419e7 r0a2168f 10 10 * Created On : Sat Sep 22 08:58:10 2001 11 11 * Last Modified By : Peter A. Buhr 12 * Last Modified On : Thu Mar 22 16:47:06 201813 * Update Count : 6 6812 * Last Modified On : Sat Mar 3 18:38:16 2018 13 * Update Count : 640 14 14 */ 15 15 … … 54 54 55 55 void rm_underscore() { 56 // SKULLDUGGERY: remove underscores (ok to shorten?)56 // Remove underscores in numeric constant by copying the non-underscore characters to the front of the string. 57 57 yyleng = 0; 58 for ( int i = 0; yytext[i] != '\0'; i += 1 ) { // copying non-underscore characters to front of string 58 for ( int i = 0; yytext[i] != '\0'; i += 1 ) { 59 if ( yytext[i] == '`' ) { 60 // copy user suffix 61 for ( ; yytext[i] != '\0'; i += 1 ) { 62 yytext[yyleng] = yytext[i]; 63 yyleng += 1; 64 } // for 65 break; 66 } // if 59 67 if ( yytext[i] != '_' ) { 60 68 yytext[yyleng] = yytext[i]; … … 63 71 } // for 64 72 yytext[yyleng] = '\0'; 65 } // rm_underscore73 } 66 74 67 75 // Stop warning due to incorrectly generated flex code. … … 82 90 attr_identifier "@"{identifier} 83 91 92 user_suffix_opt ("`"{identifier})? 93 84 94 // numeric constants, CFA: '_' in constant 85 95 hex_quad {hex}("_"?{hex}){3} 86 96 size_opt (8|16|32|64|128)? 87 97 length ("ll"|"LL"|[lL]{size_opt})|("hh"|"HH"|[hH]) 88 integer_suffix_opt ("_"?(([uU]({length}?[iI]?)|([iI]{length}))|([iI]({length}?[uU]?)|([uU]{length}))|({length}([iI]?[uU]?)|([uU][iI]))|[zZ]))? 98 integer_suffix_opt ("_"?(([uU]({length}?[iI]?)|([iI]{length}))|([iI]({length}?[uU]?)|([uU]{length}))|({length}([iI]?[uU]?)|([uU][iI]))|[zZ]))?{user_suffix_opt} 89 99 90 100 octal_digits ({octal})|({octal}({octal}|"_")*{octal}) … … 108 118 floating_length ([fFdDlL]|[lL]{floating_size}) 109 119 floating_suffix ({floating_length}?[iI]?)|([iI]{floating_length}) 110 floating_suffix_opt ("_"?({floating_suffix}|"DL"))? 120 floating_suffix_opt ("_"?({floating_suffix}|"DL"))?{user_suffix_opt} 111 121 decimal_digits ({decimal})|({decimal}({decimal}|"_")*{decimal}) 112 122 floating_decimal {decimal_digits}"."{exponent}?{floating_suffix_opt} … … 115 125 116 126 binary_exponent "_"?[pP]"_"?[+-]?{decimal_digits} 117 hex_floating_suffix_opt ("_"?({floating_suffix}))? 127 hex_floating_suffix_opt ("_"?({floating_suffix}))?{user_suffix_opt} 118 128 hex_floating_fraction ({hex_digits}?"."{hex_digits})|({hex_digits}".") 119 129 hex_floating_constant {hex_prefix}(({hex_floating_fraction}{binary_exponent})|({hex_digits}{binary_exponent})){hex_floating_suffix_opt} … … 304 314 /* identifier */ 305 315 {identifier} { IDENTIFIER_RETURN(); } 306 "`"{identifier}"`" { // CFA307 yytext[yyleng - 1] = '\0'; yytext += 1; // SKULLDUGGERY: remove backquotes (ok to shorten?)308 IDENTIFIER_RETURN();309 }310 316 {attr_identifier} { ATTRIBUTE_RETURN(); } 317 "`" { BEGIN BKQUOTE; } 318 <BKQUOTE>{identifier} { IDENTIFIER_RETURN(); } 319 <BKQUOTE>"`" { BEGIN 0; } 311 320 312 321 /* numeric constants */ … … 323 332 ({cwide_prefix}[_]?)?['] { BEGIN QUOTE; rm_underscore(); strtext = new string( yytext, yyleng ); } 324 333 <QUOTE>[^'\\\n]* { strtext->append( yytext, yyleng ); } 325 <QUOTE>['\n] { BEGIN 0; strtext->append( yytext, yyleng ); RETURN_STR(CHARACTERconstant); }334 <QUOTE>['\n]{user_suffix_opt} { BEGIN 0; strtext->append( yytext, yyleng ); RETURN_STR(CHARACTERconstant); } 326 335 /* ' stop editor highlighting */ 327 336 … … 329 338 ({swide_prefix}[_]?)?["] { BEGIN STRING; rm_underscore(); strtext = new string( yytext, yyleng ); } 330 339 <STRING>[^"\\\n]* { strtext->append( yytext, yyleng ); } 331 <STRING>["\n] { BEGIN 0; strtext->append( yytext, yyleng ); RETURN_STR(STRINGliteral); }340 <STRING>["\n]{user_suffix_opt} { BEGIN 0; strtext->append( yytext, yyleng ); RETURN_STR(STRINGliteral); } 332 341 /* " stop editor highlighting */ 333 342 … … 339 348 /* punctuation */ 340 349 "@" { ASCIIOP_RETURN(); } 341 "`" { ASCIIOP_RETURN(); }342 350 "[" { ASCIIOP_RETURN(); } 343 351 "]" { ASCIIOP_RETURN(); } … … 404 412 "?"({op_unary_pre_post}|"()"|"[?]"|"{}") { IDENTIFIER_RETURN(); } 405 413 "^?{}" { IDENTIFIER_RETURN(); } 406 "?`"{identifier} { IDENTIFIER_RETURN(); } // postfixoperator414 "?`"{identifier} { IDENTIFIER_RETURN(); } // unit operator 407 415 "?"{op_binary_over}"?" { IDENTIFIER_RETURN(); } // binary 408 416 /*
Note:
See TracChangeset
for help on using the changeset viewer.