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

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

Issue 474063002: Mojo: add support for {double,float}.{INFINITY,NEGATIVE_INFINITY,NAN} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test Created 6 years, 4 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 6104615f3fa7e6154036b0e8aa80c675297831c7..b890f232869fa596cb0854ed422634ca31d03ffc 100644
--- a/mojo/public/tools/bindings/pylib/mojom/parse/lexer.py
+++ b/mojo/public/tools/bindings/pylib/mojom/parse/lexer.py
@@ -78,7 +78,7 @@ class Lexer(object):
# Constants
'ORDINAL',
'INT_CONST_DEC', 'INT_CONST_HEX',
- 'FLOAT_CONST',
+ 'FLOAT_CONST', 'FLOAT_BUILTIN',
# String literals
'STRING_LITERAL',
@@ -146,6 +146,8 @@ class Lexer(object):
floating_constant = \
'(((('+fractional_constant+')'+ \
exponent_part+'?)|([0-9]+'+exponent_part+')))'
+ floating_builtin = \
+ r"""(((double)|(float))\.((NAN)|((NEGATIVE_)?INFINITY)))"""
# Ordinals
ordinal = r'@[0-9]+'
@@ -200,6 +202,10 @@ class Lexer(object):
def t_FLOAT_CONST(self, t):
return t
+ @TOKEN(floating_builtin)
+ def t_FLOAT_BUILTIN(self, t):
+ return t
+
@TOKEN(hex_constant)
def t_INT_CONST_HEX(self, t):
return t

Powered by Google App Engine
This is Rietveld 408576698