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

Unified Diff: mojo/public/tools/bindings/pylib/mojom/parse/lexer.py

Issue 291173010: Mojo: Mojom: Remove support for octal. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months 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
Index: mojo/public/tools/bindings/pylib/mojom/parse/lexer.py
diff --git a/mojo/public/tools/bindings/pylib/mojom/parse/lexer.py b/mojo/public/tools/bindings/pylib/mojom/parse/lexer.py
index f4769e73737eaa2b9a874da6847f9a24c4367462..ad13311edef7c3bd6914c09c6d7a5afa2954a9b4 100644
--- a/mojo/public/tools/bindings/pylib/mojom/parse/lexer.py
+++ b/mojo/public/tools/bindings/pylib/mojom/parse/lexer.py
@@ -79,7 +79,7 @@ class Lexer(object):
# Constants
'ORDINAL',
- 'INT_CONST_DEC', 'INT_CONST_OCT', 'INT_CONST_HEX',
+ 'INT_CONST_DEC', 'INT_CONST_HEX',
'FLOAT_CONST',
'CHAR_CONST',
@@ -117,10 +117,9 @@ class Lexer(object):
# integer constants (K&R2: A.2.5.1)
decimal_constant = '0|([1-9][0-9]*)'
- octal_constant = '0[0-7]+'
hex_constant = hex_prefix+hex_digits
-
- bad_octal_constant = '0[0-7]*[89]'
+ # Don't allow octal constants (even invalid octal).
+ octal_constant_disallowed = '0[0-9]+'
# character constants (K&R2: A.2.5.2)
# Note: a-zA-Z and '.-~^_!=&;,' are allowed as escape chars to support #line
@@ -219,15 +218,11 @@ class Lexer(object):
def t_INT_CONST_HEX(self, t):
return t
- @TOKEN(bad_octal_constant)
- def t_BAD_CONST_OCT(self, t):
- msg = "Invalid octal constant"
+ @TOKEN(octal_constant_disallowed)
+ def t_OCTAL_CONSTANT_DISALLOWED(self, t):
+ msg = "Octal values not allowed"
self._error(msg, t)
- @TOKEN(octal_constant)
- def t_INT_CONST_OCT(self, t):
- return t
-
@TOKEN(decimal_constant)
def t_INT_CONST_DEC(self, t):
return t
« no previous file with comments | « mojo/public/interfaces/bindings/tests/sample_service.mojom ('k') | mojo/public/tools/bindings/pylib/mojom/parse/parser.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698