Reviewers: marja,
Message:
Committed patchset #1 manually as r18607 (presubmit successful).
Description:
Experimental parser: make marker local
[email protected]
BUG=
Committed: https://code.google.com/p/v8/source/detail?r=18607
Please review this at https://codereview.chromium.org/137063007/
SVN Base: https://v8.googlecode.com/svn/branches/experimental/parser
Affected files (+5, -7 lines):
M src/lexer/experimental-scanner.h
M tools/lexer_generator/code_generator.jinja
Index: src/lexer/experimental-scanner.h
diff --git a/src/lexer/experimental-scanner.h
b/src/lexer/experimental-scanner.h
index
204ae88df895ae62a26dfee1ca8d8a3afd78eabd..8a9a96e1e4df2560ba0841ccd86d1201b60030d6
100644
--- a/src/lexer/experimental-scanner.h
+++ b/src/lexer/experimental-scanner.h
@@ -292,7 +292,6 @@ class ExperimentalScanner : public ScannerBase {
buffer_end_(NULL),
start_(NULL),
cursor_(NULL),
- marker_(NULL),
last_octal_end_(NULL) {
ASSERT(source->IsFlat());
UpdateBufferBasedOnHandle();
@@ -322,13 +321,11 @@ class ExperimentalScanner : public ScannerBase {
if (new_buffer != buffer_) {
int start_offset = start_ - buffer_;
int cursor_offset = cursor_ - buffer_;
- int marker_offset = marker_ - buffer_;
int last_octal_end_offset = last_octal_end_ - buffer_;
buffer_ = new_buffer;
buffer_end_ = buffer_ + source_handle_->length();
start_ = buffer_ + start_offset;
cursor_ = buffer_ + cursor_offset;
- marker_ = buffer_ + marker_offset;
if (last_octal_end_ != NULL) {
last_octal_end_ = buffer_ + last_octal_end_offset;
}
@@ -373,7 +370,6 @@ class ExperimentalScanner : public ScannerBase {
const Char* buffer_end_;
const Char* start_;
const Char* cursor_;
- const Char* marker_;
// Where we have seen the last octal number or an octal escape inside a
// string. Used by octal_position().
@@ -385,7 +381,6 @@ template<typename Char>
void ExperimentalScanner<Char>::SeekForward(int pos) {
cursor_ = buffer_ + pos;
start_ = cursor_;
- marker_ = cursor_;
has_line_terminator_before_next_ = false;
has_multiline_comment_before_next_ = false;
Scan(); // Fills in next_.
Index: tools/lexer_generator/code_generator.jinja
diff --git a/tools/lexer_generator/code_generator.jinja
b/tools/lexer_generator/code_generator.jinja
index
77ae4742fb92f54972df27ebe2e4acddf2669e5b..75d95b0c412807a6b803898bcaf049ad6d242f6c
100644
--- a/tools/lexer_generator/code_generator.jinja
+++ b/tools/lexer_generator/code_generator.jinja
@@ -72,7 +72,7 @@
{% if type == 'store_token' %}
stored_token = Token::{{value}};
{% elif type == 'set_marker' %}
- marker_ = cursor_ - {{value}};
+ marker = cursor_ - {{value}};
{% elif type == 'set_has_escapes' %}
next_.has_escapes = true;
{% elif type == 'octal_inside_string' %}
@@ -101,7 +101,7 @@
{% if type == 'terminate' %}
{{dispatch_match_action('backtrack', ('1', 'EOS'))}}
{% elif type == 'terminate_illegal' %}
- start_ = marker_;
+ start_ = marker;
{{dispatch_match_action('backtrack', ('1', 'ILLEGAL'))}}
{% elif type == 'skip' %}
RESET_START();
@@ -322,6 +322,7 @@ void ExperimentalScanner<{{char_type}}>::Scan() {
// Setup environment.
next_.has_escapes = false;
Token::Value stored_token;
+ const {{char_type}} * marker;
{{char_type}} primary_char;
READ_CURSOR();
@@ -343,6 +344,8 @@ void ExperimentalScanner<{{char_type}}>::Scan() {
if (false) {
// force use of stored_token
stored_token = Token::ILLEGAL;
+ // force use of marker
+ marker = NULL;
// force use of state_entry_0
goto state_entry_0;
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.