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

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

Issue 55143005: Experimental parser: kill unnecessary rules. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years, 1 month 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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 389
390 <Identifier> identifier_char+ { goto yyc_Identifier; } 390 <Identifier> identifier_char+ { goto yyc_Identifier; }
391 <Identifier> "\\u" [0-9a-fA-F]{4} { if (ValidIdentifierPart()) { goto yyc_Id entifier; } YYSETCONDITION(kConditionNormal); send(Token::ILLEGAL); start_ = cur sor_; goto yyc_Normal; } 391 <Identifier> "\\u" [0-9a-fA-F]{4} { if (ValidIdentifierPart()) { goto yyc_Id entifier; } YYSETCONDITION(kConditionNormal); send(Token::ILLEGAL); start_ = cur sor_; goto yyc_Normal; }
392 <Identifier> "\\" { PUSH_TOKEN(Token::ILLEGAL); } 392 <Identifier> "\\" { PUSH_TOKEN(Token::ILLEGAL); }
393 <Identifier> any { PUSH_TOKEN_LOOKAHEAD(Token::IDENTIFIER); } 393 <Identifier> any { PUSH_TOKEN_LOOKAHEAD(Token::IDENTIFIER); }
394 394
395 <IdentifierIllegal> identifier_start { PUSH_TOKEN_LOOKAHEAD(Token::ILLEGAL) ; } 395 <IdentifierIllegal> identifier_start { PUSH_TOKEN_LOOKAHEAD(Token::ILLEGAL) ; }
396 <IdentifierIllegal> identifier_char\identifier_start { marker_ = cursor_; g oto yyc_IdentifierIllegal; } 396 <IdentifierIllegal> identifier_char\identifier_start { marker_ = cursor_; g oto yyc_IdentifierIllegal; }
397 <IdentifierIllegal> "\\u" [0-9a-fA-F]{4} { if (ValidIdentifierStart()) { cur sor_ -= 6; PUSH_TOKEN(Token::ILLEGAL); } marker_ = cursor_; PUSH_TOKEN(Token::IL LEGAL); } 397 <IdentifierIllegal> "\\u" [0-9a-fA-F]{4} { if (ValidIdentifierStart()) { cur sor_ -= 6; PUSH_TOKEN(Token::ILLEGAL); } marker_ = cursor_; PUSH_TOKEN(Token::IL LEGAL); }
398 <IdentifierIllegal> "\\"+ { marker_ = cursor_; goto yyc_Identifi erIllegal; } 398 <IdentifierIllegal> "\\"+ { marker_ = cursor_; goto yyc_Identifi erIllegal; }
399 <IdentifierIllegal> number not_identifier_char { YYCTYPE* temp = cursor_; cu rsor_ = marker_; send(Token::ILLEGAL); cursor_ = temp; YYSETCONDITION(kCondition Normal); PUSH_TOKEN_LOOKAHEAD(Token::NUMBER); }
400 <IdentifierIllegal> number "\\u" [0-9a-fA-F]{4} { YYCTYPE* temp = cursor_; c ursor_ = marker_; send(Token::ILLEGAL); cursor_ = temp; send(Token::ILLEGAL); st art_ = cursor_; goto yyc_IdentifierIllegal; }
401 <IdentifierIllegal> any { PUSH_TOKEN_LOOKAHEAD(Token::ILLEGAL) ; } 399 <IdentifierIllegal> any { PUSH_TOKEN_LOOKAHEAD(Token::ILLEGAL) ; }
402 400
403 <SingleLineComment> line_terminator { PUSH_LINE_TERMINATOR();} 401 <SingleLineComment> line_terminator { PUSH_LINE_TERMINATOR();}
404 <SingleLineComment> eof { start_ = cursor_ - 1; PUSH_TOKEN(Token ::EOS); } 402 <SingleLineComment> eof { start_ = cursor_ - 1; PUSH_TOKEN(Token ::EOS); }
405 <SingleLineComment> any { goto yyc_SingleLineComment; } 403 <SingleLineComment> any { goto yyc_SingleLineComment; }
406 404
407 <MultiLineComment> [*][//] { PUSH_LINE_TERMINATOR();} 405 <MultiLineComment> [*][//] { PUSH_LINE_TERMINATOR();}
408 <MultiLineComment> eof { start_ = cursor_ - 1; PUSH_TOKEN(Token::EOS); } 406 <MultiLineComment> eof { start_ = cursor_ - 1; PUSH_TOKEN(Token::EOS); }
409 <MultiLineComment> any { goto yyc_MultiLineComment; } 407 <MultiLineComment> any { goto yyc_MultiLineComment; }
410 408
(...skipping 29 matching lines...) Expand all
440 size_t start_offset = start_ - buffer_; 438 size_t start_offset = start_ - buffer_;
441 memmove(buffer_, start_, limit_ - start_); 439 memmove(buffer_, start_, limit_ - start_);
442 marker_ -= start_offset; 440 marker_ -= start_offset;
443 cursor_ -= start_offset; 441 cursor_ -= start_offset;
444 limit_ -= start_offset; 442 limit_ -= start_offset;
445 start_ -= start_offset; 443 start_ -= start_offset;
446 real_start_ += start_offset; 444 real_start_ += start_offset;
447 } 445 }
448 return 0; 446 return 0;
449 } 447 }
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