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 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 "==" <|push_token(EQ)|> | 58 "==" <|push_token(EQ)|> |
59 "=" <|push_token(ASSIGN)|> | 59 "=" <|push_token(ASSIGN)|> |
60 "!==" <|push_token(NE_STRICT)|> | 60 "!==" <|push_token(NE_STRICT)|> |
61 "!=" <|push_token(NE)|> | 61 "!=" <|push_token(NE)|> |
62 "!" <|push_token(NOT)|> | 62 "!" <|push_token(NOT)|> |
63 | 63 |
64 "//" <||SingleLineComment> | 64 "//" <||SingleLineComment> |
65 "/*" <||MultiLineComment> | 65 "/*" <||MultiLineComment> |
66 "<!--" <||HtmlComment> | 66 "<!--" <||HtmlComment> |
67 | 67 |
68 #whitespace* "-->" { if (just_seen_line_terminator_) { YYSETCONDITION(kCondition
SingleLineComment); goto yyc_SingleLineComment; } else { --cursor_; send(Token::
DEC); start_ = cursor_; goto yyc_Normal; } } | 68 whitespace? "-->" <{ |
| 69 if (!just_seen_line_terminator_) { |
| 70 PUSH_TOKEN(Token::DEC); |
| 71 start_ = cursor_ - 1; |
| 72 goto code_start; |
| 73 } |
| 74 }||SingleLineComment> |
69 | 75 |
70 ">>>=" <|push_token(ASSIGN_SHR)|> | 76 ">>>=" <|push_token(ASSIGN_SHR)|> |
71 ">>>" <|push_token(SHR)|> | 77 ">>>" <|push_token(SHR)|> |
72 "<<=" <|push_token(ASSIGN_SHL)|> | 78 "<<=" <|push_token(ASSIGN_SHL)|> |
73 ">>=" <|push_token(ASSIGN_SAR)|> | 79 ">>=" <|push_token(ASSIGN_SAR)|> |
74 "<=" <|push_token(LTE)|> | 80 "<=" <|push_token(LTE)|> |
75 ">=" <|push_token(GTE)|> | 81 ">=" <|push_token(GTE)|> |
76 "<<" <|push_token(SHL)|> | 82 "<<" <|push_token(SHL)|> |
77 ">>" <|push_token(SAR)|> | 83 ">>" <|push_token(SAR)|> |
78 "<" <|push_token(LT)|> | 84 "<" <|push_token(LT)|> |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 "typeof" <|push_token(TYPEOF)|> | 164 "typeof" <|push_token(TYPEOF)|> |
159 "var" <|push_token(VAR)|> | 165 "var" <|push_token(VAR)|> |
160 "void" <|push_token(VOID)|> | 166 "void" <|push_token(VOID)|> |
161 "while" <|push_token(WHILE)|> | 167 "while" <|push_token(WHILE)|> |
162 "with" <|push_token(WITH)|> | 168 "with" <|push_token(WITH)|> |
163 "yield" <|push_token(YIELD)|> | 169 "yield" <|push_token(YIELD)|> |
164 | 170 |
165 identifier_start <|push_token(IDENTIFIER)|Identifier> | 171 identifier_start <|push_token(IDENTIFIER)|Identifier> |
166 /\\u[0-9a-fA-F]{4}/ <{ | 172 /\\u[0-9a-fA-F]{4}/ <{ |
167 if (V8_UNLIKELY(!ValidIdentifierStart())) { | 173 if (V8_UNLIKELY(!ValidIdentifierStart())) { |
168 PUSH_TOKEN(Token::ILLEGAL); | 174 goto default_action; |
169 // need to goto something here | |
170 } | 175 } |
171 }|push_token(IDENTIFIER)|Identifier> | 176 }|push_token(IDENTIFIER)|Identifier> |
172 | 177 |
173 eof <|terminate|> | 178 eof <|terminate|> |
174 default_action <push_token(ILLEGAL)> | 179 default_action <push_token(ILLEGAL)> |
175 | 180 |
176 <<DoubleQuoteString>> | 181 <<DoubleQuoteString>> |
177 /\\\n\r?/ <||continue> | 182 /\\\n\r?/ <||continue> |
178 /\\\r\n?/ <||continue> | 183 /\\\r\n?/ <||continue> |
179 /\\./ <||continue> | 184 /\\./ <||continue> |
180 /\n|\r/ <|push_token(ILLEGAL)|> | 185 /\n|\r/ <|push_token(ILLEGAL)|> |
181 "\"" <|push_token(STRING)|> | 186 "\"" <|push_token(STRING)|> |
182 eof <|terminate_illegal|> | 187 eof <|terminate_illegal|> |
183 catch_all <||continue> | 188 catch_all <||continue> |
184 | 189 |
185 <<SingleQuoteString>> | 190 <<SingleQuoteString>> |
186 /\\\n\r?/ <||continue> | 191 /\\\n\r?/ <||continue> |
187 /\\\r\n?/ <||continue> | 192 /\\\r\n?/ <||continue> |
188 /\\./ <||continue> | 193 /\\./ <||continue> |
189 /\n|\r/ <|push_token(ILLEGAL)|> | 194 /\n|\r/ <|push_token(ILLEGAL)|> |
190 "'" <|push_token(STRING)|> | 195 "'" <|push_token(STRING)|> |
191 eof <|terminate_illegal|> | 196 eof <|terminate_illegal|> |
192 catch_all <||continue> | 197 catch_all <||continue> |
193 | 198 |
194 <<Identifier>> | 199 <<Identifier>> |
195 identifier_char <|push_token(IDENTIFIER)|continue> | 200 identifier_char <|push_token(IDENTIFIER)|continue> |
196 /\\u[0-9a-fA-F]{4}/ <{ | 201 /\\u[0-9a-fA-F]{4}/ <{ |
197 if (V8_UNLIKELY(!ValidIdentifierStart())) { | 202 if (V8_UNLIKELY(!ValidIdentifierPart())) { |
198 PUSH_TOKEN(Token::ILLEGAL); | 203 goto default_action; |
199 // need to goto something here | |
200 } | 204 } |
201 }|push_token(IDENTIFIER)|continue> | 205 }|push_token(IDENTIFIER)|continue> |
202 | 206 |
203 <<SingleLineComment>> | 207 <<SingleLineComment>> |
204 line_terminator <|push_line_terminator|> | 208 line_terminator <|push_line_terminator|> |
205 catch_all <||continue> | 209 catch_all <||continue> |
206 | 210 |
207 <<MultiLineComment>> | 211 <<MultiLineComment>> |
208 "*/" <|skip|> | 212 "*/" <|skip|> |
209 # TODO find a way to generate the below rule | 213 # TODO find a way to generate the below rule |
210 /\*[^\/]/ <||continue> | 214 /\*[^\/]/ <||continue> |
211 line_terminator <push_line_terminator||continue> | 215 line_terminator <push_line_terminator||continue> |
212 catch_all <||continue> | 216 catch_all <||continue> |
213 | 217 |
214 <<HtmlComment>> | 218 <<HtmlComment>> |
215 "-->" <|skip|> | 219 "-->" <|skip|> |
216 # TODO find a way to generate the below rules | 220 # TODO find a way to generate the below rules |
217 /--./ <||continue> | 221 /--./ <||continue> |
218 /-./ <||continue> | 222 /-./ <||continue> |
219 line_terminator <push_line_terminator||continue> | 223 line_terminator <push_line_terminator||continue> |
220 catch_all <||continue> | 224 catch_all <||continue> |
OLD | NEW |