Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Unified Diff: tools/lexer_generator/code_generator.jinja

Issue 64023004: Experimental lexer generator: Misc fixes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/lexer/lexer_py.re ('k') | tools/lexer_generator/transition_keys.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/lexer_generator/code_generator.jinja
diff --git a/tools/lexer_generator/code_generator.jinja b/tools/lexer_generator/code_generator.jinja
index acc2262b0c513ac435f2ed3af685142a96b79a71..ed780f98d4b5d696a876b19c52b90e1dccf1e688 100644
--- a/tools/lexer_generator/code_generator.jinja
+++ b/tools/lexer_generator/code_generator.jinja
@@ -1,6 +1,5 @@
#include "lexer/even-more-experimental-scanner.h"
-
{# TODO implement CLASS checks #}
{%- macro do_key(key) -%}
{%- for r in key -%}
@@ -16,8 +15,10 @@
({{r[1][0]}} <= yych && yych <= {{r[1][1]}})
{%- endif -%}
{%- elif r[0] == 'CLASS' -%}
- {%- if r[1] == 'eof' -%}
- (yych == 0 && cursor_ == buffer_end_)
+ {%- if r[1] == 'eos' -%}
+ (yych == 0 && cursor_ >= buffer_end_)
+ {%- elif r[1] == 'zero' -%}
+ (yych == 0 && cursor_ < buffer_end_)
{%- else -%}
false
{%- endif -%}
@@ -142,7 +143,8 @@
}
#define PUSH_EOS() { \
- --cursor_; \
+ --start_; \
+ cursor_ -= 2; \
PUSH_TOKEN(Token::EOS); \
}
@@ -152,11 +154,13 @@
}
#define FORWARD() { \
- yych = *(++cursor_); \
+ if (++cursor_ >= buffer_end_) yych = 0; \
+ else yych = *(cursor_); \
}
#define BACKWARD() { \
- yych = *(--cursor_); \
+ if (--cursor_ >= buffer_end_) yych = 0; \
+ else yych = *(cursor_); \
}
#define SKIP() { \
« no previous file with comments | « src/lexer/lexer_py.re ('k') | tools/lexer_generator/transition_keys.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698