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

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

Issue 31453004: Experimental parser: unify regexp handling with the baseline some more. (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 | src/lexer/lexer-shell.cc » ('j') | 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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 319
320 <Normal> identifier_start_ :=> Identifier 320 <Normal> identifier_start_ :=> Identifier
321 321
322 <Normal> eof { PUSH_EOF_AND_RETURN();} 322 <Normal> eof { PUSH_EOF_AND_RETURN();}
323 <Normal> any { PUSH_TOKEN(Token::ILLEGAL); } 323 <Normal> any { PUSH_TOKEN(Token::ILLEGAL); }
324 324
325 <DoubleQuoteString> "\\\"" { goto yy0; } 325 <DoubleQuoteString> "\\\"" { goto yy0; }
326 <DoubleQuoteString> '"' { PUSH_TOKEN(Token::STRING);} 326 <DoubleQuoteString> '"' { PUSH_TOKEN(Token::STRING);}
327 <DoubleQuoteString> "\\" "\n" "\r"? { goto yy0; } 327 <DoubleQuoteString> "\\" "\n" "\r"? { goto yy0; }
328 <DoubleQuoteString> "\\" "\r" "\n"? { goto yy0; } 328 <DoubleQuoteString> "\\" "\r" "\n"? { goto yy0; }
329 <DoubleQuoteString> line_terminator { TERMINATE_ILLEGAL(); } 329 <DoubleQuoteString> "\n" => Normal { PUSH_TOKEN_LOOKAHEAD(Token::ILLEGAL) ; }
330 <DoubleQuoteString> "\r" => Normal { PUSH_TOKEN_LOOKAHEAD(Token::ILLEGAL) ; }
330 <DoubleQuoteString> eof { TERMINATE_ILLEGAL(); } 331 <DoubleQuoteString> eof { TERMINATE_ILLEGAL(); }
331 <DoubleQuoteString> any { goto yy0; } 332 <DoubleQuoteString> any { goto yy0; }
332 333
333 <SingleQuoteString> "\\'" { goto yy0; } 334 <SingleQuoteString> "\\'" { goto yy0; }
334 <SingleQuoteString> "'" { PUSH_TOKEN(Token::STRING);} 335 <SingleQuoteString> "'" { PUSH_TOKEN(Token::STRING);}
335 <SingleQuoteString> "\\" "\n" "\r"? { goto yy0; } 336 <SingleQuoteString> "\\" "\n" "\r"? { goto yy0; }
336 <SingleQuoteString> "\\" "\r" "\n"? { goto yy0; } 337 <SingleQuoteString> "\\" "\r" "\n"? { goto yy0; }
337 <SingleQuoteString> line_terminator { TERMINATE_ILLEGAL(); } 338 <SingleQuoteString> "\n" => Normal { PUSH_TOKEN_LOOKAHEAD(Token::ILLEGAL) ; }
339 <SingleQuoteString> "\r" => Normal { PUSH_TOKEN_LOOKAHEAD(Token::ILLEGAL) ; }
338 <SingleQuoteString> eof { TERMINATE_ILLEGAL(); } 340 <SingleQuoteString> eof { TERMINATE_ILLEGAL(); }
339 <SingleQuoteString> any { goto yy0; } 341 <SingleQuoteString> any { goto yy0; }
340 342
341 <Identifier> identifier_char+ { goto yy0; } 343 <Identifier> identifier_char+ { goto yy0; }
342 <Identifier> illegal_after_identifier { PUSH_TOKEN(Token::ILLEGAL); } 344 <Identifier> illegal_after_identifier { PUSH_TOKEN(Token::ILLEGAL); }
343 <Identifier> any { PUSH_TOKEN_LOOKAHEAD(Token::IDENTIFIER); } 345 <Identifier> any { PUSH_TOKEN_LOOKAHEAD(Token::IDENTIFIER); }
344 346
345 <SingleLineComment> line_terminator { PUSH_LINE_TERMINATOR();} 347 <SingleLineComment> line_terminator { PUSH_LINE_TERMINATOR();}
346 <SingleLineComment> eof { PUSH_LINE_TERMINATOR();} 348 <SingleLineComment> eof { PUSH_LINE_TERMINATOR();}
347 <SingleLineComment> any { goto yy0; } 349 <SingleLineComment> any { goto yy0; }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 size_t start_offset = start_ - buffer_; 383 size_t start_offset = start_ - buffer_;
382 memmove(buffer_, start_, limit_ - start_); 384 memmove(buffer_, start_, limit_ - start_);
383 marker_ -= start_offset; 385 marker_ -= start_offset;
384 cursor_ -= start_offset; 386 cursor_ -= start_offset;
385 limit_ -= start_offset; 387 limit_ -= start_offset;
386 start_ -= start_offset; 388 start_ -= start_offset;
387 real_start_ += start_offset; 389 real_start_ += start_offset;
388 } 390 }
389 return 0; 391 return 0;
390 } 392 }
OLDNEW
« no previous file with comments | « no previous file | src/lexer/lexer-shell.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698