Changeset 5f2f2d7 for src/Parser/lex.ll


Ignore:
Timestamp:
Jun 8, 2015, 8:56:35 PM (9 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
Children:
81419b5
Parents:
cd623a4
Message:

fix constant types, remove unnecessary string copying, work on regression testing, fix several memory leaks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/lex.ll

    rcd623a4 r5f2f2d7  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Sun Jun  7 07:14:16 2015
    13  * Update Count     : 374
     12 * Last Modified On : Mon Jun  8 20:24:15 2015
     13 * Update Count     : 381
    1414 */
    1515
    1616%option yylineno
     17%option nounput
    1718
    1819%{
     
    3233std::string *strtext;                                                                   // accumulate parts of character and string constant value
    3334
     35#define RETURN_LOCN(x)          yylval.tok.loc.file = yyfilename; yylval.tok.loc.line = yylineno; return(x)
     36#define RETURN_VAL(x)           yylval.tok.str = new std::string( yytext ); RETURN_LOCN(x)
     37#define RETURN_CHAR(x)          yylval.tok.str = NULL; RETURN_LOCN(x)
     38#define RETURN_STR(x)           yylval.tok.str = strtext; RETURN_LOCN(x)
     39
    3440#define WHITE_RETURN(x)                                                                 // do nothing
    3541#define NEWLINE_RETURN()        WHITE_RETURN('\n')
    36 #define RETURN_VAL(x)           yylval.tok.str = new std::string( yytext ); \
    37                                         yylval.tok.loc.file = yyfilename; \
    38                                         yylval.tok.loc.line = yylineno; \
    39                                         return(x)
    40 #define RETURN_STR(x)           yylval.tok.str = strtext; \
    41                                         yylval.tok.loc.file = yyfilename; \
    42                                         yylval.tok.loc.line = yylineno; \
    43                                         return(x)
    44 
    45 #define KEYWORD_RETURN(x)       RETURN_VAL(x)                           // keyword
     42#define ASCIIOP_RETURN()        RETURN_CHAR((int)yytext[0])     // single character operator
     43#define NAMEDOP_RETURN(x)       RETURN_VAL(x)                           // multichar operator, with a name
     44#define NUMERIC_RETURN(x)       rm_underscore(); RETURN_VAL(x) // numeric constant
     45#define KEYWORD_RETURN(x)       RETURN_CHAR(x)                          // keyword
    4646#define IDENTIFIER_RETURN()     RETURN_VAL((typedefTable.isIdentifier(yytext) ? IDENTIFIER : typedefTable.isTypedef(yytext) ? TYPEDEFname : TYPEGENname))
    47 //#define ATTRIBUTE_RETURN()    RETURN_VAL((typedefTable.isIdentifier(yytext) ? ATTR_IDENTIFIER : typedefTable.isTypedef(yytext) ? ATTR_TYPEDEFname : ATTR_TYPEGENname))
    4847#define ATTRIBUTE_RETURN()      RETURN_VAL(ATTR_IDENTIFIER)
    49 
    50 #define ASCIIOP_RETURN()        RETURN_VAL((int)yytext[0])      // single character operator
    51 #define NAMEDOP_RETURN(x)       RETURN_VAL(x)                           // multichar operator, with a name
    52 
    53 #define NUMERIC_RETURN(x)       rm_underscore(); RETURN_VAL(x) // numeric constant
    5448
    5549void rm_underscore() {
Note: See TracChangeset for help on using the changeset viewer.