diff options
author | asargent@chromium.org <asargent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-15 22:30:11 +0000 |
---|---|---|
committer | asargent@chromium.org <asargent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-15 22:30:11 +0000 |
commit | da2779345b281f06d0bfd6791171b3d70bccfbfb (patch) | |
tree | ab639aa82aaa6c904568bf7e43daebb4dc1c0d14 /ppapi/generators | |
parent | 9ae3a4d9944cebe3ac7b68bfd41f1555d9643f5b (diff) | |
download | chromium_src-da2779345b281f06d0bfd6791171b3d70bccfbfb.zip chromium_src-da2779345b281f06d0bfd6791171b3d70bccfbfb.tar.gz chromium_src-da2779345b281f06d0bfd6791171b3d70bccfbfb.tar.bz2 |
Allow leading underscore on identifier names in IDL parser
This lets us have identifiers that match reserved words.
BUG=166268
Review URL: https://chromiumcodereview.appspot.com/11565053
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173332 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/generators')
-rwxr-xr-x | ppapi/generators/idl_lexer.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ppapi/generators/idl_lexer.py b/ppapi/generators/idl_lexer.py index d45a4b8..4120ac7 100755 --- a/ppapi/generators/idl_lexer.py +++ b/ppapi/generators/idl_lexer.py @@ -64,7 +64,6 @@ class IDLLexer(object): # Invented for apps use 'NAMESPACE', - # Data types 'FLOAT', 'OCT', @@ -144,10 +143,15 @@ class IDLLexer(object): # A symbol or keyword. def t_KEYWORD_SYMBOL(self, t): - r'[A-Za-z][A-Za-z_0-9]*' + r'_?[A-Za-z][A-Za-z_0-9]*' - #All non-keywords are assumed to be symbols + # All non-keywords are assumed to be symbols t.type = self.keywords.get(t.value, 'SYMBOL') + + # We strip leading underscores so that you can specify symbols with the same + # value as a keywords (E.g. a dictionary named 'interface'). + if t.value[0] == '_': + t.value = t.value[1:] return t def t_ANY_error(self, t): |