Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/lex.ll

    r7e419e7 r0a2168f  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Thu Mar 22 16:47:06 2018
    13  * Update Count     : 668
     12 * Last Modified On : Sat Mar  3 18:38:16 2018
     13 * Update Count     : 640
    1414 */
    1515
     
    5454
    5555void 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.
    5757        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
    5967                if ( yytext[i] != '_' ) {
    6068                        yytext[yyleng] = yytext[i];
     
    6371        } // for
    6472        yytext[yyleng] = '\0';
    65 } // rm_underscore
     73}
    6674
    6775// Stop warning due to incorrectly generated flex code.
     
    8290attr_identifier "@"{identifier}
    8391
     92user_suffix_opt ("`"{identifier})?
     93
    8494                                // numeric constants, CFA: '_' in constant
    8595hex_quad {hex}("_"?{hex}){3}
    8696size_opt (8|16|32|64|128)?
    8797length ("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]))?
     98integer_suffix_opt ("_"?(([uU]({length}?[iI]?)|([iI]{length}))|([iI]({length}?[uU]?)|([uU]{length}))|({length}([iI]?[uU]?)|([uU][iI]))|[zZ]))?{user_suffix_opt}
    8999
    90100octal_digits ({octal})|({octal}({octal}|"_")*{octal})
     
    108118floating_length ([fFdDlL]|[lL]{floating_size})
    109119floating_suffix ({floating_length}?[iI]?)|([iI]{floating_length})
    110 floating_suffix_opt ("_"?({floating_suffix}|"DL"))?
     120floating_suffix_opt ("_"?({floating_suffix}|"DL"))?{user_suffix_opt}
    111121decimal_digits ({decimal})|({decimal}({decimal}|"_")*{decimal})
    112122floating_decimal {decimal_digits}"."{exponent}?{floating_suffix_opt}
     
    115125
    116126binary_exponent "_"?[pP]"_"?[+-]?{decimal_digits}
    117 hex_floating_suffix_opt ("_"?({floating_suffix}))?
     127hex_floating_suffix_opt ("_"?({floating_suffix}))?{user_suffix_opt}
    118128hex_floating_fraction ({hex_digits}?"."{hex_digits})|({hex_digits}".")
    119129hex_floating_constant {hex_prefix}(({hex_floating_fraction}{binary_exponent})|({hex_digits}{binary_exponent})){hex_floating_suffix_opt}
     
    304314                                /* identifier */
    305315{identifier}    { IDENTIFIER_RETURN(); }
    306 "`"{identifier}"`" {                                                                    // CFA
    307         yytext[yyleng - 1] = '\0'; yytext += 1;                         // SKULLDUGGERY: remove backquotes (ok to shorten?)
    308         IDENTIFIER_RETURN();
    309 }
    310316{attr_identifier} { ATTRIBUTE_RETURN(); }
     317"`"                             { BEGIN BKQUOTE; }
     318<BKQUOTE>{identifier} { IDENTIFIER_RETURN(); }
     319<BKQUOTE>"`"    { BEGIN 0; }
    311320
    312321                                /* numeric constants */
     
    323332({cwide_prefix}[_]?)?['] { BEGIN QUOTE; rm_underscore(); strtext = new string( yytext, yyleng ); }
    324333<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); }
    326335                                /* ' stop editor highlighting */
    327336
     
    329338({swide_prefix}[_]?)?["] { BEGIN STRING; rm_underscore(); strtext = new string( yytext, yyleng ); }
    330339<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); }
    332341                                /* " stop editor highlighting */
    333342
     
    339348                                /* punctuation */
    340349"@"                             { ASCIIOP_RETURN(); }
    341 "`"                             { ASCIIOP_RETURN(); }
    342350"["                             { ASCIIOP_RETURN(); }
    343351"]"                             { ASCIIOP_RETURN(); }
     
    404412"?"({op_unary_pre_post}|"()"|"[?]"|"{}") { IDENTIFIER_RETURN(); }
    405413"^?{}"                  { IDENTIFIER_RETURN(); }
    406 "?`"{identifier} { IDENTIFIER_RETURN(); }                               // postfix operator
     414"?`"{identifier} { IDENTIFIER_RETURN(); }                               // unit operator
    407415"?"{op_binary_over}"?"  { IDENTIFIER_RETURN(); }                // binary
    408416        /*
Note: See TracChangeset for help on using the changeset viewer.