Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: src/lexer/lexer.re

Issue 28993002: Experimental parser: Fix multi-line strings. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Portions of this code based on re2c: 1 // Portions of this code based on re2c:
2 // (re2c/examples/push.re) 2 // (re2c/examples/push.re)
3 // Copyright 2013 the V8 project authors. All rights reserved. 3 // Copyright 2013 the V8 project authors. All rights reserved.
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 <Normal> ["] :=> DoubleQuoteString 315 <Normal> ["] :=> DoubleQuoteString
316 <Normal> ['] :=> SingleQuoteString 316 <Normal> ['] :=> SingleQuoteString
317 317
318 <Normal> identifier_start_ :=> Identifier 318 <Normal> identifier_start_ :=> Identifier
319 319
320 <Normal> eof { PUSH_EOF_AND_RETURN();} 320 <Normal> eof { PUSH_EOF_AND_RETURN();}
321 <Normal> any { TERMINATE_ILLEGAL(); } 321 <Normal> any { TERMINATE_ILLEGAL(); }
322 322
323 <DoubleQuoteString> "\\\"" { goto yy0; } 323 <DoubleQuoteString> "\\\"" { goto yy0; }
324 <DoubleQuoteString> '"' { PUSH_TOKEN(Token::STRING);} 324 <DoubleQuoteString> '"' { PUSH_TOKEN(Token::STRING);}
325 <DoubleQuoteString> "\\" "\n" "\r"? { goto yy0; }
326 <DoubleQuoteString> "\\" "\r" "\n"? { goto yy0; }
325 <DoubleQuoteString> line_terminator { TERMINATE_ILLEGAL(); } 327 <DoubleQuoteString> line_terminator { TERMINATE_ILLEGAL(); }
326 <DoubleQuoteString> eof { TERMINATE_ILLEGAL(); } 328 <DoubleQuoteString> eof { TERMINATE_ILLEGAL(); }
327 <DoubleQuoteString> any { goto yy0; } 329 <DoubleQuoteString> any { goto yy0; }
328 330
329 <SingleQuoteString> "\\'" { goto yy0; } 331 <SingleQuoteString> "\\'" { goto yy0; }
330 <SingleQuoteString> "'" { PUSH_TOKEN(Token::STRING);} 332 <SingleQuoteString> "'" { PUSH_TOKEN(Token::STRING);}
333 <SingleQuoteString> "\\" "\n" "\r"? { goto yy0; }
334 <SingleQuoteString> "\\" "\r" "\n"? { goto yy0; }
331 <SingleQuoteString> line_terminator { TERMINATE_ILLEGAL(); } 335 <SingleQuoteString> line_terminator { TERMINATE_ILLEGAL(); }
332 <SingleQuoteString> eof { TERMINATE_ILLEGAL(); } 336 <SingleQuoteString> eof { TERMINATE_ILLEGAL(); }
333 <SingleQuoteString> any { goto yy0; } 337 <SingleQuoteString> any { goto yy0; }
334 338
335 <Identifier> identifier_char+ { goto yy0; } 339 <Identifier> identifier_char+ { goto yy0; }
336 <Identifier> any { PUSH_TOKEN_LOOKAHEAD(Token::IDENTIFIER); } 340 <Identifier> any { PUSH_TOKEN_LOOKAHEAD(Token::IDENTIFIER); }
337 341
338 <SingleLineComment> line_terminator { PUSH_LINE_TERMINATOR();} 342 <SingleLineComment> line_terminator { PUSH_LINE_TERMINATOR();}
339 <SingleLineComment> eof { PUSH_LINE_TERMINATOR();} 343 <SingleLineComment> eof { PUSH_LINE_TERMINATOR();}
340 <SingleLineComment> any { goto yy0; } 344 <SingleLineComment> any { goto yy0; }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 size_t start_offset = start_ - buffer_; 378 size_t start_offset = start_ - buffer_;
375 memmove(buffer_, start_, limit_ - start_); 379 memmove(buffer_, start_, limit_ - start_);
376 marker_ -= start_offset; 380 marker_ -= start_offset;
377 cursor_ -= start_offset; 381 cursor_ -= start_offset;
378 limit_ -= start_offset; 382 limit_ -= start_offset;
379 start_ -= start_offset; 383 start_ -= start_offset;
380 real_start_ += start_offset; 384 real_start_ += start_offset;
381 } 385 }
382 return 0; 386 return 0;
383 } 387 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698