Changeset c1c1112 for src/Parser/lex.cc


Ignore:
Timestamp:
Aug 25, 2016, 9:14:06 PM (8 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, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
4e2b9710
Parents:
2acf5fc
Message:

fix segment fault when printing syntax error, more refactoring of parser code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/lex.cc

    r2acf5fc rc1c1112  
    14691469 * Created On       : Sat Sep 22 08:58:10 2001
    14701470 * Last Modified By : Peter A. Buhr
    1471  * Last Modified On : Thu Aug 18 22:17:30 2016
    1472  * Update Count     : 472
     1471 * Last Modified On : Wed Aug 24 13:27:04 2016
     1472 * Update Count     : 487
    14731473 */
    14741474#line 20 "lex.ll"
     
    18271827{
    18281828        /* " stop highlighting */
    1829         static char *filename[FILENAME_MAX];                            // temporarily store current source-file name
     1829        static char filename[FILENAME_MAX];                                     // temporarily store current source-file name
    18301830        char *end_num;
    18311831        char *begin_string, *end_string;
     
    18421842                //std::cout << "file " << filename << " line " << lineno << std::endl;
    18431843                yylineno = lineno;
    1844                 yyfilename = filename[0];
     1844                yyfilename = filename;
    18451845        } // if
    18461846}
     
    24262426YY_RULE_SETUP
    24272427#line 290 "lex.ll"
    2428 { BEGIN QUOTE; rm_underscore(); strtext = new std::string; *strtext += std::string( yytext ); }
     2428{ BEGIN QUOTE; rm_underscore(); strtext = new std::string( yytext, yyleng ); }
    24292429        YY_BREAK
    24302430case 116:
    24312431YY_RULE_SETUP
    24322432#line 291 "lex.ll"
    2433 { *strtext += std::string( yytext ); }
     2433{ strtext->append( yytext, yyleng ); }
    24342434        YY_BREAK
    24352435case 117:
     
    24372437YY_RULE_SETUP
    24382438#line 292 "lex.ll"
    2439 { BEGIN 0; *strtext += std::string( yytext); RETURN_STR(CHARACTERconstant); }
     2439{ BEGIN 0; strtext->append( yytext, yyleng ); RETURN_STR(CHARACTERconstant); }
    24402440        YY_BREAK
    24412441/* ' stop highlighting */
     
    24442444YY_RULE_SETUP
    24452445#line 296 "lex.ll"
    2446 { BEGIN STRING; rm_underscore(); strtext = new std::string; *strtext += std::string( yytext ); }
     2446{ BEGIN STRING; rm_underscore(); strtext = new std::string( yytext, yyleng ); }
    24472447        YY_BREAK
    24482448case 119:
    24492449YY_RULE_SETUP
    24502450#line 297 "lex.ll"
    2451 { *strtext += std::string( yytext ); }
     2451{ strtext->append( yytext, yyleng ); }
    24522452        YY_BREAK
    24532453case 120:
     
    24552455YY_RULE_SETUP
    24562456#line 298 "lex.ll"
    2457 { BEGIN 0; *strtext += std::string( yytext ); RETURN_STR(STRINGliteral); }
     2457{ BEGIN 0; strtext->append( yytext, yyleng ); RETURN_STR(STRINGliteral); }
    24582458        YY_BREAK
    24592459/* " stop highlighting */
     
    24622462YY_RULE_SETUP
    24632463#line 302 "lex.ll"
    2464 { rm_underscore(); *strtext += std::string( yytext ); }
     2464{ rm_underscore(); strtext->append( yytext, yyleng ); }
    24652465        YY_BREAK
    24662466case 122:
     
    24732473YY_RULE_SETUP
    24742474#line 304 "lex.ll"
    2475 { *strtext += std::string( yytext ); } // unknown escape character
     2475{ strtext->append( yytext, yyleng ); } // unknown escape character
    24762476        YY_BREAK
    24772477/* punctuation */
Note: See TracChangeset for help on using the changeset viewer.