| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 non_octal_whole_part = "0" | ( | 44 non_octal_whole_part = "0" | ( |
| 45 /0[:digit:]*[8-9][:digit:]*/ | | 45 /0[:digit:]*[8-9][:digit:]*/ | |
| 46 /[1-9][:digit:]*/ ); | 46 /[1-9][:digit:]*/ ); |
| 47 | 47 |
| 48 number = | 48 number = |
| 49 /0[xX][:hex_digit:]+/ | ( | 49 /0[xX][:hex_digit:]+/ | ( |
| 50 /\.[:digit:]+/ maybe_exponent | | 50 /\.[:digit:]+/ maybe_exponent | |
| 51 non_octal_whole_part /(\.[:digit:]*)?/ maybe_exponent ); | 51 non_octal_whole_part /(\.[:digit:]*)?/ maybe_exponent ); |
| 52 harmony_number = "0"[bBoO][:digit:]+; | 52 harmony_number = "0"[bBoO][:digit:]+; |
| 53 line_terminator_sequence = /[:line_terminator:]|(\r\n|\n\r)/; | 53 line_terminator_sequence = /[:line_terminator:]|(\r\n|\n\r)/; |
| 54 eos = [:eos:]; | |
| 55 | 54 |
| 56 # Rules. | 55 # Rules. |
| 57 | 56 |
| 58 # Grammar is | 57 # Grammar is |
| 59 # regex <entry_action|match_action|transition> | 58 # regex <entry_action|match_action|transition> |
| 60 # | 59 # |
| 61 # Actions are identifiers to be passed to codegen. | 60 # Actions are identifiers to be passed to codegen. |
| 62 # | 61 # |
| 63 # Entry action is executed when we enter the corresponding automaton state, that | 62 # Entry action is executed when we enter the corresponding automaton state, that |
| 64 # is, right after seeing something that matches the regex. Match action is | 63 # is, right after seeing something that matches the regex. Match action is |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 "typeof" <|token(TYPEOF)|> | 189 "typeof" <|token(TYPEOF)|> |
| 191 "var" <|token(VAR)|> | 190 "var" <|token(VAR)|> |
| 192 "void" <|token(VOID)|> | 191 "void" <|token(VOID)|> |
| 193 "while" <|token(WHILE)|> | 192 "while" <|token(WHILE)|> |
| 194 "with" <|token(WITH)|> | 193 "with" <|token(WITH)|> |
| 195 "yield" <|token(YIELD)|> | 194 "yield" <|token(YIELD)|> |
| 196 | 195 |
| 197 identifier_start <|token(IDENTIFIER)|Identifier> | 196 identifier_start <|token(IDENTIFIER)|Identifier> |
| 198 /\\u[:hex_digit:]{4}/ <check_escaped_identifier_start|token(IDENTIFIER)|Identifi
er> | 197 /\\u[:hex_digit:]{4}/ <check_escaped_identifier_start|token(IDENTIFIER)|Identifi
er> |
| 199 | 198 |
| 200 eos <|terminate|> | 199 eos <terminate> |
| 201 default_action <do_token_and_go_forward(ILLEGAL)> | 200 default_action <do_token_and_go_forward(ILLEGAL)> |
| 202 | 201 |
| 203 <<DoubleQuoteString>> | 202 <<DoubleQuoteString>> |
| 204 "\\" line_terminator_sequence <set_has_escapes||continue> | 203 "\\" line_terminator_sequence <set_has_escapes||continue> |
| 205 /\\[x][:hex_digit:]{2}/ <set_has_escapes||continue> | 204 /\\[x][:hex_digit:]{2}/ <set_has_escapes||continue> |
| 206 /\\[u][:hex_digit:]{4}/ <set_has_escapes||continue> | 205 /\\[u][:hex_digit:]{4}/ <set_has_escapes||continue> |
| 207 /\\[1-7]/ <octal_inside_string||continue> | 206 /\\[1-7]/ <octal_inside_string||continue> |
| 208 /\\[0-7][0-7]+/ <octal_inside_string||continue> | 207 /\\[0-7][0-7]+/ <octal_inside_string||continue> |
| 209 "\\0" <set_has_escapes||continue> | 208 "\\0" <set_has_escapes||continue> |
| 210 /\\[^xu0-7:line_terminator:]/ <set_has_escapes||continue> | 209 /\\[^xu0-7:line_terminator:]/ <set_has_escapes||continue> |
| 211 "\\" <|token(ILLEGAL)|> | 210 "\\" <|token(ILLEGAL)|> |
| 212 line_terminator <|token(ILLEGAL)|> | 211 line_terminator <|token(ILLEGAL)|> |
| 213 "\"" <|token(STRING)|> | 212 "\"" <|token(STRING)|> |
| 214 eos <|terminate_illegal|> | |
| 215 catch_all <||continue> | 213 catch_all <||continue> |
| 214 eos <terminate_illegal> |
| 216 | 215 |
| 217 <<SingleQuoteString>> | 216 <<SingleQuoteString>> |
| 218 # TODO subgraph for '\' | 217 # TODO subgraph for '\' |
| 219 "\\" line_terminator_sequence <set_has_escapes||continue> | 218 "\\" line_terminator_sequence <set_has_escapes||continue> |
| 220 /\\[x][:hex_digit:]{2}/ <set_has_escapes||continue> | 219 /\\[x][:hex_digit:]{2}/ <set_has_escapes||continue> |
| 221 /\\[u][:hex_digit:]{4}/ <set_has_escapes||continue> | 220 /\\[u][:hex_digit:]{4}/ <set_has_escapes||continue> |
| 222 /\\[1-7]/ <octal_inside_string||continue> | 221 /\\[1-7]/ <octal_inside_string||continue> |
| 223 /\\[0-7][0-7]+/ <octal_inside_string||continue> | 222 /\\[0-7][0-7]+/ <octal_inside_string||continue> |
| 224 "\\0" <set_has_escapes||continue> | 223 "\\0" <set_has_escapes||continue> |
| 225 /\\[^xu0-7:line_terminator:]/ <set_has_escapes||continue> | 224 /\\[^xu0-7:line_terminator:]/ <set_has_escapes||continue> |
| 226 "\\" <|token(ILLEGAL)|> | 225 "\\" <|token(ILLEGAL)|> |
| 227 line_terminator <|token(ILLEGAL)|> | 226 line_terminator <|token(ILLEGAL)|> |
| 228 "'" <|token(STRING)|> | 227 "'" <|token(STRING)|> |
| 229 eos <|terminate_illegal|> | |
| 230 catch_all <||continue> | 228 catch_all <||continue> |
| 229 eos <terminate_illegal> |
| 231 | 230 |
| 232 <<Identifier>> | 231 <<Identifier>> |
| 233 identifier_char <|token(IDENTIFIER)|continue> | 232 identifier_char <|token(IDENTIFIER)|continue> |
| 234 /\\u[:hex_digit:]{4}/ <check_escaped_identifier_part|token(IDENTIFIER)|continue> | 233 /\\u[:hex_digit:]{4}/ <check_escaped_identifier_part|token(IDENTIFIER)|continue> |
| 235 | 234 |
| 236 <<SingleLineComment>> | 235 <<SingleLineComment>> |
| 237 line_terminator <|line_terminator|> | 236 line_terminator <|line_terminator|> |
| 238 eos <|skip_and_terminate|> | 237 eos <skip_and_terminate> |
| 239 catch_all <||continue> | 238 catch_all <||continue> |
| 240 | 239 |
| 241 <<MultiLineComment>> | 240 <<MultiLineComment>> |
| 242 /\*+\// <|skip|> | 241 /\*+\// <|skip|> |
| 243 # TODO find a way to generate the below rule | 242 # TODO find a way to generate the below rule |
| 244 /\*+[^\/*]/ <||continue> | 243 /\*+[^\/*]/ <||continue> |
| 245 line_terminator <line_terminator_in_multiline_comment||continue> | 244 line_terminator <line_terminator_in_multiline_comment||continue> |
| 246 eos <|terminate_illegal|> | |
| 247 catch_all <||continue> | 245 catch_all <||continue> |
| 246 eos <terminate_illegal> |
| OLD | NEW |