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

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

Issue 50983003: 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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 <Normal> "<<=" { PUSH_TOKEN(Token::ASSIGN_SHL); } 317 <Normal> "<<=" { PUSH_TOKEN(Token::ASSIGN_SHL); }
318 <Normal> ">>=" { PUSH_TOKEN(Token::ASSIGN_SAR); } 318 <Normal> ">>=" { PUSH_TOKEN(Token::ASSIGN_SAR); }
319 <Normal> "<=" { PUSH_TOKEN(Token::LTE); } 319 <Normal> "<=" { PUSH_TOKEN(Token::LTE); }
320 <Normal> ">=" { PUSH_TOKEN(Token::GTE); } 320 <Normal> ">=" { PUSH_TOKEN(Token::GTE); }
321 <Normal> "<<" { PUSH_TOKEN(Token::SHL); } 321 <Normal> "<<" { PUSH_TOKEN(Token::SHL); }
322 <Normal> ">>" { PUSH_TOKEN(Token::SAR); } 322 <Normal> ">>" { PUSH_TOKEN(Token::SAR); }
323 <Normal> "<" { PUSH_TOKEN(Token::LT); } 323 <Normal> "<" { PUSH_TOKEN(Token::LT); }
324 <Normal> ">" { PUSH_TOKEN(Token::GT); } 324 <Normal> ">" { PUSH_TOKEN(Token::GT); }
325 325
326 <Normal> number not_identifier_char { PUSH_TOKEN_LOOKAHEAD(Token::NUMBER); } 326 <Normal> number not_identifier_char { PUSH_TOKEN_LOOKAHEAD(Token::NUMBER); }
327 <Normal> number "\\u" [0-9a-fA-F]{4} { cursor_ -= 6; send(Token::ILLEGAL); s tart_ = cursor_; cursor_ += 6; if (ValidIdentifierStart()) { YYSETCONDITION(kCon ditionIdentifier); goto yyc_Identifier; } else { PUSH_TOKEN(Token::ILLEGAL); } }
328 <Normal> number any { PUSH_TOKEN_LOOKAHEAD(Token::ILLEGAL); } 327 <Normal> number any { PUSH_TOKEN_LOOKAHEAD(Token::ILLEGAL); }
329 328
330 <Normal> "(" { PUSH_TOKEN(Token::LPAREN); } 329 <Normal> "(" { PUSH_TOKEN(Token::LPAREN); }
331 <Normal> ")" { PUSH_TOKEN(Token::RPAREN); } 330 <Normal> ")" { PUSH_TOKEN(Token::RPAREN); }
332 <Normal> "[" { PUSH_TOKEN(Token::LBRACK); } 331 <Normal> "[" { PUSH_TOKEN(Token::LBRACK); }
333 <Normal> "]" { PUSH_TOKEN(Token::RBRACK); } 332 <Normal> "]" { PUSH_TOKEN(Token::RBRACK); }
334 <Normal> "{" { PUSH_TOKEN(Token::LBRACE); } 333 <Normal> "{" { PUSH_TOKEN(Token::LBRACE); }
335 <Normal> "}" { PUSH_TOKEN(Token::RBRACE); } 334 <Normal> "}" { PUSH_TOKEN(Token::RBRACE); }
336 <Normal> ":" { PUSH_TOKEN(Token::COLON); } 335 <Normal> ":" { PUSH_TOKEN(Token::COLON); }
337 <Normal> ";" { PUSH_TOKEN(Token::SEMICOLON); } 336 <Normal> ";" { PUSH_TOKEN(Token::SEMICOLON); }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 <SingleQuoteString> "\n" => Normal { PUSH_TOKEN_LOOKAHEAD(Token::ILLEGAL) ; } 384 <SingleQuoteString> "\n" => Normal { PUSH_TOKEN_LOOKAHEAD(Token::ILLEGAL) ; }
386 <SingleQuoteString> "\r" => Normal { PUSH_TOKEN_LOOKAHEAD(Token::ILLEGAL) ; } 385 <SingleQuoteString> "\r" => Normal { PUSH_TOKEN_LOOKAHEAD(Token::ILLEGAL) ; }
387 <SingleQuoteString> eof { TERMINATE_ILLEGAL(); } 386 <SingleQuoteString> eof { TERMINATE_ILLEGAL(); }
388 <SingleQuoteString> any { goto yyc_SingleQuoteString; } 387 <SingleQuoteString> any { goto yyc_SingleQuoteString; }
389 388
390 <Identifier> identifier_char+ { goto yyc_Identifier; } 389 <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; } 390 <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); } 391 <Identifier> "\\" { PUSH_TOKEN(Token::ILLEGAL); }
393 <Identifier> any { PUSH_TOKEN_LOOKAHEAD(Token::IDENTIFIER); } 392 <Identifier> any { PUSH_TOKEN_LOOKAHEAD(Token::IDENTIFIER); }
394 393
395 <IdentifierIllegal> identifier_start { PUSH_TOKEN_LOOKAHEAD(Token::ILLEGAL) ; }
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); }
398 <IdentifierIllegal> "\\"+ { marker_ = cursor_; goto yyc_Identifi erIllegal; }
399 <IdentifierIllegal> any { PUSH_TOKEN_LOOKAHEAD(Token::ILLEGAL) ; }
400
401 <SingleLineComment> line_terminator { PUSH_LINE_TERMINATOR();} 394 <SingleLineComment> line_terminator { PUSH_LINE_TERMINATOR();}
402 <SingleLineComment> eof { start_ = cursor_ - 1; PUSH_TOKEN(Token ::EOS); } 395 <SingleLineComment> eof { start_ = cursor_ - 1; PUSH_TOKEN(Token ::EOS); }
403 <SingleLineComment> any { goto yyc_SingleLineComment; } 396 <SingleLineComment> any { goto yyc_SingleLineComment; }
404 397
405 <MultiLineComment> [*][//] { PUSH_LINE_TERMINATOR();} 398 <MultiLineComment> [*][//] { PUSH_LINE_TERMINATOR();}
406 <MultiLineComment> eof { start_ = cursor_ - 1; PUSH_TOKEN(Token::EOS); } 399 <MultiLineComment> eof { start_ = cursor_ - 1; PUSH_TOKEN(Token::EOS); }
407 <MultiLineComment> any { goto yyc_MultiLineComment; } 400 <MultiLineComment> any { goto yyc_MultiLineComment; }
408 401
409 <HtmlComment> eof { start_ = cursor_ - 1; PUSH_TOKEN(Token::EOS); } 402 <HtmlComment> eof { start_ = cursor_ - 1; PUSH_TOKEN(Token::EOS); }
410 <HtmlComment> "-->" { PUSH_LINE_TERMINATOR();} 403 <HtmlComment> "-->" { PUSH_LINE_TERMINATOR();}
(...skipping 27 matching lines...) Expand all
438 size_t start_offset = start_ - buffer_; 431 size_t start_offset = start_ - buffer_;
439 memmove(buffer_, start_, limit_ - start_); 432 memmove(buffer_, start_, limit_ - start_);
440 marker_ -= start_offset; 433 marker_ -= start_offset;
441 cursor_ -= start_offset; 434 cursor_ -= start_offset;
442 limit_ -= start_offset; 435 limit_ -= start_offset;
443 start_ -= start_offset; 436 start_ -= start_offset;
444 real_start_ += start_offset; 437 real_start_ += start_offset;
445 } 438 }
446 return 0; 439 return 0;
447 } 440 }
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