Changeset 59db689 for src/Parser/lex.ll
- Timestamp:
- Jun 6, 2015, 11:38:58 PM (9 years ago)
- 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:
- cd623a4
- Parents:
- a65d92e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/lex.ll
ra65d92e r59db689 10 10 * Created On : Sat Sep 22 08:58:10 2001 11 11 * Last Modified By : Peter A. Buhr 12 * Last Modified On : Wed Jun 3 22:24:07 201513 * Update Count : 3 3612 * Last Modified On : Fri Jun 5 17:50:17 2015 13 * Update Count : 373 14 14 */ 15 15 … … 27 27 #include "lex.h" 28 28 #include "ParseNode.h" 29 #include "parser.h" // YACC generated definitions based on C++ grammar29 #include "parser.h" // YACC generated definitions based on C++ grammar 30 30 31 31 char *yyfilename; … … 34 34 #define WHITE_RETURN(x) // do nothing 35 35 #define NEWLINE_RETURN() WHITE_RETURN('\n') 36 #define RETURN_VAL(x) yylval.tok.str = new std::string( yytext); \36 #define RETURN_VAL(x) yylval.tok.str = new std::string( yytext ); \ 37 37 yylval.tok.loc.file = yyfilename; \ 38 38 yylval.tok.loc.line = yylineno; \ … … 114 114 hex_escape "\\""x""_"?{hex_digits} 115 115 escape_seq {simple_escape}|{octal_escape}|{hex_escape}|{universal_char} 116 cwide_prefix "L"|"U"|"u" 117 swide_prefix {cwide_prefix}|"u8" 116 118 117 119 // display/white-space characters … … 275 277 "0" { NUMERIC_RETURN(ZERO); } // CFA 276 278 "1" { NUMERIC_RETURN(ONE); } // CFA 277 {decimal_constant} 278 {octal_constant} 279 {hex_constant} 279 {decimal_constant} { NUMERIC_RETURN(INTEGERconstant); } 280 {octal_constant} { NUMERIC_RETURN(INTEGERconstant); } 281 {hex_constant} { NUMERIC_RETURN(INTEGERconstant); } 280 282 {floating_constant} { NUMERIC_RETURN(FLOATINGconstant); } 281 283 {hex_floating_constant} { NUMERIC_RETURN(FLOATINGconstant); } 282 284 283 285 /* character constant, allows empty value */ 284 "L"?"_"?[']{ BEGIN QUOTE; rm_underscore(); strtext = new std::string; *strtext += std::string( yytext ); }286 ({cwide_prefix}[_]?)?['] { BEGIN QUOTE; rm_underscore(); strtext = new std::string; *strtext += std::string( yytext ); } 285 287 <QUOTE>[^'\\\n]* { *strtext += std::string( yytext ); } 286 288 <QUOTE>['\n] { BEGIN 0; *strtext += std::string( yytext); RETURN_STR(CHARACTERconstant); } … … 288 290 289 291 /* string constant */ 290 "L"?"_"?["]{ BEGIN STRING; rm_underscore(); strtext = new std::string; *strtext += std::string( yytext ); }292 ({swide_prefix}[_]?)?["] { BEGIN STRING; rm_underscore(); strtext = new std::string; *strtext += std::string( yytext ); } 291 293 <STRING>[^"\\\n]* { *strtext += std::string( yytext ); } 292 <STRING>["\n] { BEGIN 0; *strtext += std::string( yytext ); RETURN_STR(STRINGliteral); }294 <STRING>["\n] { BEGIN 0; *strtext += std::string( yytext ); RETURN_STR(STRINGliteral); } 293 295 /* " stop highlighting */ 294 296 297 /* common character/string constant */ 295 298 <QUOTE,STRING>{escape_seq} { rm_underscore(); *strtext += std::string( yytext ); } 296 <QUOTE,STRING>[\\] { *strtext += std::string( yytext ); } // unknown escape character 299 <QUOTE,STRING>"\\"{h_white}*"\n" {} // continuation 300 <QUOTE,STRING>"\\" { *strtext += std::string( yytext ); } // unknown escape character 297 301 298 302 /* punctuation */
Note: See TracChangeset
for help on using the changeset viewer.