| 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
|
|
|