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

Unified Diff: tools/lexer_generator/transition_keys.py

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 | « tools/lexer_generator/code_generator.jinja ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/lexer_generator/transition_keys.py
diff --git a/tools/lexer_generator/transition_keys.py b/tools/lexer_generator/transition_keys.py
index 4e650969f1ae8d866c6b99c32d433d46b6d14b92..92d50b96334301c3cce92a65ebc66fc5fb3efc88 100644
--- a/tools/lexer_generator/transition_keys.py
+++ b/tools/lexer_generator/transition_keys.py
@@ -30,13 +30,14 @@ from string import printable
class TransitionKey:
__class_bounds = {
- "latin_1" : (0, 255),
+ "latin_1" : (1, 255),
# These are not "real" ranges; they just need to be separate.
"whitespace" : (256, 256),
"literal" : (257, 257),
- "eof" : (258, 258),
+ "eos" : (258, 258),
+ "zero" : (259, 259),
}
- __lower_bound = 0
+ __lower_bound = 1
__upper_bound = reduce(lambda acc, (k, v): max(acc, v[1]), __class_bounds.items(), 0)
__cached_keys = {}
@@ -135,11 +136,13 @@ class TransitionKey:
elif key == 'CHARACTER_CLASS':
class_name = graph[1]
if class_name == 'ws':
- ranges.append(TransitionKey.__class_bounds["whitespace"])
+ ranges.append(TransitionKey.__class_bounds['whitespace'])
elif class_name == 'lit':
- ranges.append(TransitionKey.__class_bounds["literal"])
- elif class_name == 'eof':
- ranges.append(TransitionKey.__class_bounds["eof"])
+ ranges.append(TransitionKey.__class_bounds['literal'])
+ elif class_name == 'eos':
+ ranges.append(TransitionKey.__class_bounds['eos'])
+ elif class_name == 'zero':
+ ranges.append(TransitionKey.__class_bounds['zero'])
elif class_name in key_map:
ranges += key_map[class_name].__ranges
else:
« no previous file with comments | « tools/lexer_generator/code_generator.jinja ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698