| 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 22 matching lines...) Expand all Loading... |
| 33 digit = [0-9]; | 33 digit = [0-9]; |
| 34 hex_digit = [0-9a-fA-F]; | 34 hex_digit = [0-9a-fA-F]; |
| 35 single_escape_char = ['"\\bfnrtv]; | 35 single_escape_char = ['"\\bfnrtv]; |
| 36 maybe_exponent = /([eE][\-+]?[:digit:]+)?/; | 36 maybe_exponent = /([eE][\-+]?[:digit:]+)?/; |
| 37 number = | 37 number = |
| 38 /0[xX][:hex_digit:]+/ | ( | 38 /0[xX][:hex_digit:]+/ | ( |
| 39 /\.[:digit:]+/ maybe_exponent | | 39 /\.[:digit:]+/ maybe_exponent | |
| 40 /[:digit:]+(\.[:digit:]*)?/ maybe_exponent ); | 40 /[:digit:]+(\.[:digit:]*)?/ maybe_exponent ); |
| 41 # TODO this is incomplete/incorrect | 41 # TODO this is incomplete/incorrect |
| 42 line_terminator_sequence = (/\n\r?/)|(/\r\n?/); | 42 line_terminator_sequence = (/\n\r?/)|(/\r\n?/); |
| 43 eof = [:eof:]; | 43 eos = [:eos:]; |
| 44 | 44 |
| 45 # grammar is | 45 # grammar is |
| 46 # regex <action_on_state_entry|action_on_match|transition> | 46 # regex <action_on_state_entry|action_on_match|transition> |
| 47 # | 47 # |
| 48 # actions can be c code enclosed in {} or identifiers to be passed to codegen | 48 # actions can be c code enclosed in {} or identifiers to be passed to codegen |
| 49 # transition must be in continue or the name of a subgraph | 49 # transition must be in continue or the name of a subgraph |
| 50 | 50 |
| 51 <<default>> | 51 <<default>> |
| 52 "|=" <|push_token(ASSIGN_BIT_OR)|> | 52 "|=" <|push_token(ASSIGN_BIT_OR)|> |
| 53 "^=" <|push_token(ASSIGN_BIT_XOR)|> | 53 "^=" <|push_token(ASSIGN_BIT_XOR)|> |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 "with" <|push_token(WITH)|> | 184 "with" <|push_token(WITH)|> |
| 185 "yield" <|push_token(YIELD)|> | 185 "yield" <|push_token(YIELD)|> |
| 186 | 186 |
| 187 identifier_start <|push_token(IDENTIFIER)|Identifier> | 187 identifier_start <|push_token(IDENTIFIER)|Identifier> |
| 188 /\\u[:hex_digit:]{4}/ <{ | 188 /\\u[:hex_digit:]{4}/ <{ |
| 189 if (V8_UNLIKELY(!ValidIdentifierStart())) { | 189 if (V8_UNLIKELY(!ValidIdentifierStart())) { |
| 190 goto default_action; | 190 goto default_action; |
| 191 } | 191 } |
| 192 }|push_token(IDENTIFIER)|Identifier> | 192 }|push_token(IDENTIFIER)|Identifier> |
| 193 | 193 |
| 194 eof <|terminate|> | 194 eos <|terminate|> |
| 195 default_action <push_token_and_go_forward(ILLEGAL)> | 195 default_action <push_token_and_go_forward(ILLEGAL)> |
| 196 | 196 |
| 197 <<DoubleQuoteString>> | 197 <<DoubleQuoteString>> |
| 198 "\\" line_terminator_sequence <||continue> | 198 "\\" line_terminator_sequence <||continue> |
| 199 /\\[x][:hex_digit:]{2}/ <||continue> | 199 /\\[x][:hex_digit:]{2}/ <||continue> |
| 200 /\\[u][:hex_digit:]{4}/ <||continue> | 200 /\\[u][:hex_digit:]{4}/ <||continue> |
| 201 /\\[^xu\r\n]/ <||continue> | 201 /\\[^xu\r\n]/ <||continue> |
| 202 "\\" <|push_token(ILLEGAL)|> | 202 "\\" <|push_token(ILLEGAL)|> |
| 203 /\n|\r/ <|push_token(ILLEGAL)|> | 203 /\n|\r/ <|push_token(ILLEGAL)|> |
| 204 "\"" <|push_token(STRING)|> | 204 "\"" <|push_token(STRING)|> |
| 205 eof <|terminate_illegal|> | 205 eos <|terminate_illegal|> |
| 206 catch_all <||continue> | 206 catch_all <||continue> |
| 207 | 207 |
| 208 <<SingleQuoteString>> | 208 <<SingleQuoteString>> |
| 209 # TODO subgraph for '\' | 209 # TODO subgraph for '\' |
| 210 "\\" line_terminator_sequence <||continue> | 210 "\\" line_terminator_sequence <||continue> |
| 211 /\\[x][:hex_digit:]{2}/ <||continue> | 211 /\\[x][:hex_digit:]{2}/ <||continue> |
| 212 /\\[u][:hex_digit:]{4}/ <||continue> | 212 /\\[u][:hex_digit:]{4}/ <||continue> |
| 213 /\\[^xu\r\n]/ <||continue> | 213 /\\[^xu\r\n]/ <||continue> |
| 214 "\\" <|push_token(ILLEGAL)|> | 214 "\\" <|push_token(ILLEGAL)|> |
| 215 /\n|\r/ <|push_token(ILLEGAL)|> | 215 /\n|\r/ <|push_token(ILLEGAL)|> |
| 216 "'" <|push_token(STRING)|> | 216 "'" <|push_token(STRING)|> |
| 217 eof <|terminate_illegal|> | 217 eos <|terminate_illegal|> |
| 218 catch_all <||continue> | 218 catch_all <||continue> |
| 219 | 219 |
| 220 <<Identifier>> | 220 <<Identifier>> |
| 221 identifier_char <|push_token(IDENTIFIER)|continue> | 221 identifier_char <|push_token(IDENTIFIER)|continue> |
| 222 /\\u[:hex_digit:]{4}/ <{ | 222 /\\u[:hex_digit:]{4}/ <{ |
| 223 if (V8_UNLIKELY(!ValidIdentifierPart())) { | 223 if (V8_UNLIKELY(!ValidIdentifierPart())) { |
| 224 goto default_action; | 224 goto default_action; |
| 225 } | 225 } |
| 226 }|push_token(IDENTIFIER)|continue> | 226 }|push_token(IDENTIFIER)|continue> |
| 227 | 227 |
| 228 <<SingleLineComment>> | 228 <<SingleLineComment>> |
| 229 line_terminator <|push_line_terminator|> | 229 line_terminator <|push_line_terminator|> |
| 230 eof <|skip_and_terminate|> | 230 eos <|skip_and_terminate|> |
| 231 catch_all <||continue> | 231 catch_all <||continue> |
| 232 | 232 |
| 233 <<MultiLineComment>> | 233 <<MultiLineComment>> |
| 234 /\*+\// <|skip|> | 234 /\*+\// <|skip|> |
| 235 # TODO find a way to generate the below rule | 235 # TODO find a way to generate the below rule |
| 236 /\*+[^\/*]/ <||continue> | 236 /\*+[^\/*]/ <||continue> |
| 237 line_terminator <push_line_terminator||continue> | 237 line_terminator <push_line_terminator||continue> |
| 238 eof <|{start_ = marker_; BACKWARD(); PUSH_TOKEN(Token::ILLEGAL);}|> | 238 eos <|{start_ = marker_; PUSH_TOKEN(Token::ILLEGAL);}|> |
| 239 catch_all <||continue> | 239 catch_all <||continue> |
| OLD | NEW |