| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 has_multiline_comment_before_next_ = true; | 81 has_multiline_comment_before_next_ = true; |
| 82 {% elif type == 'store_token' %} | 82 {% elif type == 'store_token' %} |
| 83 stored_token = Token::{{args[0]}}; | 83 stored_token = Token::{{args[0]}}; |
| 84 {% elif type == 'store_harmony_token' %} | 84 {% elif type == 'store_harmony_token' %} |
| 85 if (harmony_{{args[0]}}_) { | 85 if (harmony_{{args[0]}}_) { |
| 86 stored_token = Token::{{args[1]}}; | 86 stored_token = Token::{{args[1]}}; |
| 87 } else { | 87 } else { |
| 88 stored_token = Token::{{args[2]}}; | 88 stored_token = Token::{{args[2]}}; |
| 89 } | 89 } |
| 90 {% elif type == 'check_escaped_identifier_start' %} | 90 {% elif type == 'check_escaped_identifier_start' %} |
| 91 if (!ValidIdentifierStart()) goto default_action; | 91 if (!unicode_cache_->IsIdentifierStart(ScanHexNumber(4))) { |
| 92 goto default_action; |
| 93 } |
| 92 next_.has_escapes = true; | 94 next_.has_escapes = true; |
| 93 {% elif type == 'check_escaped_identifier_part' %} | 95 {% elif type == 'check_escaped_identifier_part' %} |
| 94 if (!ValidIdentifierPart()) goto default_action; | 96 if (!unicode_cache_->IsIdentifierPart(ScanHexNumber(4))) { |
| 97 goto default_action; |
| 98 } |
| 95 next_.has_escapes = true; | 99 next_.has_escapes = true; |
| 96 {% elif type == 'if_line_terminator_backtrack' %} | 100 {% elif type == 'if_line_terminator_backtrack' %} |
| 97 if (!has_line_terminator_before_next_) { | 101 if (!has_line_terminator_before_next_) { |
| 98 {{dispatch_match_action('manual_backtrack', args)}} | 102 {{dispatch_match_action('manual_backtrack', args)}} |
| 99 } | 103 } |
| 100 {% elif type == 'store_lexing_state' %} | 104 {% elif type == 'store_lexing_state' %} |
| 101 STORE_LEXING_STATE(); | 105 STORE_LEXING_STATE(); |
| 102 {% elif type == 'chain' %} | 106 {% elif type == 'chain' %} |
| 103 {%- for arg in args %} | 107 {%- for arg in args %} |
| 104 {{dispatch_entry_action(arg.name(), arg.args())}} | 108 {{dispatch_entry_action(arg.name(), arg.args())}} |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 {%- endif -%} | 296 {%- endif -%} |
| 293 | 297 |
| 294 {%- if state['omega_transition'] %} | 298 {%- if state['omega_transition'] %} |
| 295 {{ do_transition(state['omega_transition'], False) }} | 299 {{ do_transition(state['omega_transition'], False) }} |
| 296 {%- endif -%} | 300 {%- endif -%} |
| 297 | 301 |
| 298 goto default_action; {# this is wrong, should be CRASH(); #} | 302 goto default_action; {# this is wrong, should be CRASH(); #} |
| 299 | 303 |
| 300 {%- endmacro %} | 304 {%- endmacro %} |
| 301 | 305 |
| 302 #include "lexer/experimental-scanner.h" | 306 #include "lexer/lexer.h" |
| 303 | 307 |
| 304 #define RESET_START() { \ | 308 #define RESET_START() { \ |
| 305 start_ = cursor_; \ | 309 start_ = cursor_; \ |
| 306 } | 310 } |
| 307 | 311 |
| 308 #define STORE_LEXING_STATE() { \ | 312 #define STORE_LEXING_STATE() { \ |
| 309 stored_marker = marker; \ | 313 stored_marker = marker; \ |
| 310 stored_cursor = cursor_; \ | 314 stored_cursor = cursor_; \ |
| 311 stored_start = start_; \ | 315 stored_start = start_; \ |
| 312 } | 316 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 336 if (cursor_ >= buffer_end_) primary_char = 0; \ | 340 if (cursor_ >= buffer_end_) primary_char = 0; \ |
| 337 else primary_char = *(cursor_); \ | 341 else primary_char = *(cursor_); \ |
| 338 } | 342 } |
| 339 | 343 |
| 340 #ifdef DEBUG | 344 #ifdef DEBUG |
| 341 #define CRASH() { ((void(*)())0)(); } | 345 #define CRASH() { ((void(*)())0)(); } |
| 342 #else | 346 #else |
| 343 #define CRASH() { } | 347 #define CRASH() { } |
| 344 #endif | 348 #endif |
| 345 | 349 |
| 350 |
| 346 namespace v8 { | 351 namespace v8 { |
| 347 namespace internal { | 352 namespace internal { |
| 348 template<> | 353 template<> |
| 349 void ExperimentalScanner<{{char_type}}>::Scan() { | 354 void Lexer<{{char_type}}>::Scan() { |
| 350 | 355 |
| 351 // Setup environment. | 356 // Setup environment. |
| 352 next_.has_escapes = false; | 357 next_.has_escapes = false; |
| 353 next_.is_onebyte = true; | 358 next_.is_onebyte = true; |
| 354 Token::Value stored_token; | 359 Token::Value stored_token; |
| 355 const {{char_type}} * marker; | 360 const {{char_type}} * marker; |
| 356 {{char_type}} primary_char; | 361 {{char_type}} primary_char; |
| 357 const {{char_type}} * stored_marker; {# TODO(dcarney): complete this #} | 362 const {{char_type}} * stored_marker; {# TODO(dcarney): complete this #} |
| 358 const {{char_type}} * stored_cursor; | 363 const {{char_type}} * stored_cursor; |
| 359 const {{char_type}} * stored_start; | 364 const {{char_type}} * stored_start; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 378 // force use of stored_token | 383 // force use of stored_token |
| 379 stored_token = Token::ILLEGAL; | 384 stored_token = Token::ILLEGAL; |
| 380 // force use of marker | 385 // force use of marker |
| 381 marker = NULL; | 386 marker = NULL; |
| 382 // force use of state_entry_0 | 387 // force use of state_entry_0 |
| 383 goto state_entry_0; | 388 goto state_entry_0; |
| 384 } | 389 } |
| 385 } | 390 } |
| 386 } } | 391 } } |
| 387 | 392 |
| OLD | NEW |