| OLD | NEW |
| 1 # Copyright 2013 the V8 project authors. All rights reserved. | 1 # Copyright 2013 the V8 project authors. All rights reserved. |
| 2 # Redistribution and use in source and binary forms, with or without | 2 # Redistribution and use in source and binary forms, with or without |
| 3 # modification, are permitted provided that the following conditions are | 3 # modification, are permitted provided that the following conditions are |
| 4 # met: | 4 # met: |
| 5 # | 5 # |
| 6 # * Redistributions of source code must retain the above copyright | 6 # * Redistributions of source code must retain the above copyright |
| 7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
| 8 # * Redistributions in binary form must reproduce the above | 8 # * Redistributions in binary form must reproduce the above |
| 9 # copyright notice, this list of conditions and the following | 9 # copyright notice, this list of conditions and the following |
| 10 # disclaimer in the documentation and/or other materials provided | 10 # disclaimer in the documentation and/or other materials provided |
| 11 # with the distribution. | 11 # with the distribution. |
| 12 # * Neither the name of Google Inc. nor the names of its | 12 # * Neither the name of Google Inc. nor the names of its |
| 13 # contributors may be used to endorse or promote products derived | 13 # contributors may be used to endorse or promote products derived |
| 14 # from this software without specific prior written permission. | 14 # from this software without specific prior written permission. |
| 15 # | 15 # |
| 16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 19 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 whitespace_char = [ \t\v\f\r\240:ws:]; | 28 whitespace_char = [ \t\v\f\r:ws:]; # TODO put back \240 |
| 29 whitespace = whitespace_char+; | 29 whitespace = whitespace_char+; |
| 30 identifier_start = [$_a-zA-Z:lit:]; | 30 identifier_start = [$_a-zA-Z:lit:]; |
| 31 identifier_char = [$_a-zA-Z0-9:lit:]; | 31 identifier_char = [$_a-zA-Z0-9:lit:]; |
| 32 not_identifier_char = [^:identifier_char:]; | 32 not_identifier_char = [^:identifier_char:]; |
| 33 line_terminator = [\n\r]+; | 33 line_terminator = [\n\r]+; |
| 34 digit = [0-9]; | 34 digit = [0-9]; |
| 35 hex_digit = [0-9a-fA-F]; | 35 hex_digit = [0-9a-fA-F]; |
| 36 maybe_exponent = ("e" [-+]? digit+)?; | 36 maybe_exponent = ("e" [\-+]? digit+)?; |
| 37 number = ("0x" hex_digit+) | (("." digit+ maybe_exponent) | (digit+ ("." digit*)
? maybe_exponent)); | 37 number = ("0x" hex_digit+) | (("." digit+ maybe_exponent) | (digit+ ("." digit*)
? maybe_exponent)); |
| 38 | 38 |
| 39 <Normal> "break" not_identifier_char { PUSH_TOKEN_LOOKAHEAD(Token::BREAK);
} | 39 <Normal> "break" not_identifier_char { PUSH_TOKEN_LOOKAHEAD(Token::BREAK);
} |
| 40 <Normal> "case" not_identifier_char { PUSH_TOKEN_LOOKAHEAD(Token::CASE); } | 40 <Normal> "case" not_identifier_char { PUSH_TOKEN_LOOKAHEAD(Token::CASE); } |
| 41 <Normal> "catch" not_identifier_char { PUSH_TOKEN_LOOKAHEAD(Token::CATCH);
} | 41 <Normal> "catch" not_identifier_char { PUSH_TOKEN_LOOKAHEAD(Token::CATCH);
} |
| 42 <Normal> "class" not_identifier_char { PUSH_TOKEN_LOOKAHEAD(Token::FUTURE_R
ESERVED_WORD); } | 42 <Normal> "class" not_identifier_char { PUSH_TOKEN_LOOKAHEAD(Token::FUTURE_R
ESERVED_WORD); } |
| 43 <Normal> "const" not_identifier_char { PUSH_TOKEN_LOOKAHEAD(Token::CONST);
} | 43 <Normal> "const" not_identifier_char { PUSH_TOKEN_LOOKAHEAD(Token::CONST);
} |
| 44 <Normal> "continue" not_identifier_char { PUSH_TOKEN_LOOKAHEAD(Token::CONTINUE
); } | 44 <Normal> "continue" not_identifier_char { PUSH_TOKEN_LOOKAHEAD(Token::CONTINUE
); } |
| 45 <Normal> "debugger" not_identifier_char { PUSH_TOKEN_LOOKAHEAD(Token::DEBUGGER
); } | 45 <Normal> "debugger" not_identifier_char { PUSH_TOKEN_LOOKAHEAD(Token::DEBUGGER
); } |
| 46 <Normal> "default" not_identifier_char { PUSH_TOKEN_LOOKAHEAD(Token::DEFAULT)
; } | 46 <Normal> "default" not_identifier_char { PUSH_TOKEN_LOOKAHEAD(Token::DEFAULT)
; } |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 <Normal> "~" { PUSH_TOKEN(Token::BIT_NOT); } | 144 <Normal> "~" { PUSH_TOKEN(Token::BIT_NOT); } |
| 145 <Normal> "," { PUSH_TOKEN(Token::COMMA); } | 145 <Normal> "," { PUSH_TOKEN(Token::COMMA); } |
| 146 | 146 |
| 147 <Normal> line_terminator { PUSH_LINE_TERMINATOR(); } | 147 <Normal> line_terminator { PUSH_LINE_TERMINATOR(); } |
| 148 <Normal> whitespace { SKIP(); } | 148 <Normal> whitespace { SKIP(); } |
| 149 | 149 |
| 150 <Normal> "\"" :=> DoubleQuoteString | 150 <Normal> "\"" :=> DoubleQuoteString |
| 151 <Normal> "'" :=> SingleQuoteString | 151 <Normal> "'" :=> SingleQuoteString |
| 152 | 152 |
| 153 <Normal> identifier_start :=> Identifier | 153 <Normal> identifier_start :=> Identifier |
| 154 <Normal> "\\u[0-9a-fA-F]{4}" { if (ValidIdentifierStart()) { YYSETCONDITION(kCon
ditionIdentifier); goto yyc_Identifier; } send(Token::ILLEGAL); start_ = cursor_
; goto yyc_Normal; } | 154 <Normal> /\\u[0-9a-fA-F]{4}/ { if (ValidIdentifierStart()) { YYSETCONDITION(kCon
ditionIdentifier); goto yyc_Identifier; } send(Token::ILLEGAL); start_ = cursor_
; goto yyc_Normal; } |
| 155 <Normal> "\\" { PUSH_TOKEN(Token::ILLEGAL); } | 155 <Normal> "\\" { PUSH_TOKEN(Token::ILLEGAL); } |
| 156 | 156 |
| 157 <Normal> eof { PUSH_EOF_AND_RETURN();} | 157 <Normal> eof { PUSH_EOF_AND_RETURN();} |
| 158 <Normal> any { PUSH_TOKEN(Token::ILLEGAL); } | 158 <Normal> any { PUSH_TOKEN(Token::ILLEGAL); } |
| 159 | 159 |
| 160 <DoubleQuoteString> "\\\\" { goto yyc_DoubleQuoteString; } | 160 <DoubleQuoteString> "\\\\" { goto yyc_DoubleQuoteString; } |
| 161 <DoubleQuoteString> "\\\"" { goto yyc_DoubleQuoteString; } | 161 <DoubleQuoteString> "\\\"" { goto yyc_DoubleQuoteString; } |
| 162 <DoubleQuoteString> "\"" { PUSH_TOKEN(Token::STRING);} | 162 <DoubleQuoteString> "\"" { PUSH_TOKEN(Token::STRING);} |
| 163 <DoubleQuoteString> "\\\n\r?" { goto yyc_DoubleQuoteString; } | 163 <DoubleQuoteString> /\\\n\r?/ { goto yyc_DoubleQuoteString; } |
| 164 <DoubleQuoteString> "\\\r\n?" { goto yyc_DoubleQuoteString; } | 164 <DoubleQuoteString> /\\\r\n?/ { goto yyc_DoubleQuoteString; } |
| 165 <DoubleQuoteString> "\n" => Normal { PUSH_TOKEN_LOOKAHEAD(Token::ILLEGAL); } | 165 <DoubleQuoteString> "\n" => Normal { PUSH_TOKEN_LOOKAHEAD(Token::ILLEGAL); } |
| 166 <DoubleQuoteString> "\r" => Normal { PUSH_TOKEN_LOOKAHEAD(Token::ILLEGAL); } | 166 <DoubleQuoteString> "\r" => Normal { PUSH_TOKEN_LOOKAHEAD(Token::ILLEGAL); } |
| 167 <DoubleQuoteString> eof { TERMINATE_ILLEGAL(); } | 167 <DoubleQuoteString> eof { TERMINATE_ILLEGAL(); } |
| 168 <DoubleQuoteString> any { goto yyc_DoubleQuoteString; } | 168 <DoubleQuoteString> any { goto yyc_DoubleQuoteString; } |
| 169 | 169 |
| 170 <SingleQuoteString> "\\\\" { goto yyc_SingleQuoteString; } | 170 <SingleQuoteString> "\\" { goto yyc_SingleQuoteString; } |
| 171 <SingleQuoteString> "\\'" { goto yyc_SingleQuoteString; } | 171 <SingleQuoteString> "\\'" { goto yyc_SingleQuoteString; } |
| 172 <SingleQuoteString> "'" { PUSH_TOKEN(Token::STRING);} | 172 <SingleQuoteString> "'" { PUSH_TOKEN(Token::STRING); } |
| 173 <SingleQuoteString> "\\\n\r?" { goto yyc_SingleQuoteString; } | 173 <SingleQuoteString> /\\\n\r?/ { goto yyc_SingleQuoteString; } |
| 174 <SingleQuoteString> "\\\r\n?" { goto yyc_SingleQuoteString; } | 174 <SingleQuoteString> /\\\r\n?/ { goto yyc_SingleQuoteString; } |
| 175 <SingleQuoteString> "\n" => Normal { PUSH_TOKEN_LOOKAHEAD(Token::ILLEGAL); } | 175 <SingleQuoteString> "\n" => Normal { PUSH_TOKEN_LOOKAHEAD(Token::ILLEGAL); } |
| 176 <SingleQuoteString> "\r" => Normal { PUSH_TOKEN_LOOKAHEAD(Token::ILLEGAL); } | 176 <SingleQuoteString> "\r" => Normal { PUSH_TOKEN_LOOKAHEAD(Token::ILLEGAL); } |
| 177 <SingleQuoteString> eof { TERMINATE_ILLEGAL(); } | 177 <SingleQuoteString> eof { TERMINATE_ILLEGAL(); } |
| 178 <SingleQuoteString> any { goto yyc_SingleQuoteString; } | 178 <SingleQuoteString> any { goto yyc_SingleQuoteString; } |
| 179 | 179 |
| 180 <Identifier> identifier_char+ { goto yyc_Identifier; } | 180 <Identifier> identifier_char+ { goto yyc_Identifier; } |
| 181 <Identifier> "\\u[0-9a-fA-F]{4}" { if (ValidIdentifierPart()) { goto yyc_Identif
ier; } YYSETCONDITION(kConditionNormal); send(Token::ILLEGAL); start_ = cursor_;
goto yyc_Normal; } | 181 <Identifier> /\\u[0-9a-fA-F]{4}/ { if (ValidIdentifierPart()) { goto yyc_Identif
ier; } YYSETCONDITION(kConditionNormal); send(Token::ILLEGAL); start_ = cursor_;
goto yyc_Normal; } |
| 182 <Identifier> "\\" { PUSH_TOKEN(Token::ILLEGAL); } | 182 <Identifier> "\\" { PUSH_TOKEN(Token::ILLEGAL); } |
| 183 <Identifier> any { PUSH_TOKEN_LOOKAHEAD(Token::IDENTIFIER); } | 183 <Identifier> any { PUSH_TOKEN_LOOKAHEAD(Token::IDENTIFIER); } |
| 184 | 184 |
| 185 <SingleLineComment> line_terminator { PUSH_LINE_TERMINATOR();} | 185 <SingleLineComment> line_terminator { PUSH_LINE_TERMINATOR();} |
| 186 <SingleLineComment> eof { start_ = cursor_ - 1; PUSH_TOKEN(Token::EO
S); } | 186 <SingleLineComment> eof { start_ = cursor_ - 1; PUSH_TOKEN(Token::EO
S); } |
| 187 <SingleLineComment> any { goto yyc_SingleLineComment; } | 187 <SingleLineComment> any { goto yyc_SingleLineComment; } |
| 188 | 188 |
| 189 <MultiLineComment> "*//" { PUSH_LINE_TERMINATOR();} | 189 <MultiLineComment> "*/" { PUSH_LINE_TERMINATOR();} |
| 190 <MultiLineComment> eof { start_ = cursor_ - 1; PUSH_TOKEN(Token::EOS); } | 190 <MultiLineComment> eof { start_ = cursor_ - 1; PUSH_TOKEN(Token::EOS); } |
| 191 <MultiLineComment> any { goto yyc_MultiLineComment; } | 191 <MultiLineComment> any { goto yyc_MultiLineComment; } |
| 192 | 192 |
| 193 <HtmlComment> eof { start_ = cursor_ - 1; PUSH_TOKEN(Token::EOS); } | |
| 194 <HtmlComment> "-->" { PUSH_LINE_TERMINATOR();} | 193 <HtmlComment> "-->" { PUSH_LINE_TERMINATOR();} |
| 195 <HtmlComment> line_terminator+ { PUSH_LINE_TERMINATOR();} | 194 <HtmlComment> line_terminator+ { PUSH_LINE_TERMINATOR();} |
| 195 <HtmlComment> eof { start_ = cursor_ - 1; PUSH_TOKEN(Token::EOS); } |
| 196 <HtmlComment> any { goto yyc_HtmlComment; } | 196 <HtmlComment> any { goto yyc_HtmlComment; } |
| OLD | NEW |