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

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

Issue 268363003: Mojo: Add support for constants to the IDL compiler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: JS export constants 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import imp 5 import imp
6 import os.path 6 import os.path
7 import sys 7 import sys
8 8
9 # Disable lint check for finding modules: 9 # Disable lint check for finding modules:
10 # pylint: disable=F0401 10 # pylint: disable=F0401
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 'DATA_PIPE_CONSUMER', 60 'DATA_PIPE_CONSUMER',
61 'DATA_PIPE_PRODUCER', 61 'DATA_PIPE_PRODUCER',
62 'MESSAGE_PIPE', 62 'MESSAGE_PIPE',
63 'SHARED_BUFFER', 63 'SHARED_BUFFER',
64 64
65 'IMPORT', 65 'IMPORT',
66 'MODULE', 66 'MODULE',
67 'STRUCT', 67 'STRUCT',
68 'INTERFACE', 68 'INTERFACE',
69 'ENUM', 69 'ENUM',
70 'CONST',
70 ) 71 )
71 72
72 keyword_map = {} 73 keyword_map = {}
73 for keyword in keywords: 74 for keyword in keywords:
74 keyword_map[keyword.lower()] = keyword 75 keyword_map[keyword.lower()] = keyword
75 76
76 ## 77 ##
77 ## All the tokens recognized by the lexer 78 ## All the tokens recognized by the lexer
78 ## 79 ##
79 tokens = keywords + ( 80 tokens = keywords + (
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 return t 284 return t
284 285
285 # Ignore C and C++ style comments 286 # Ignore C and C++ style comments
286 def t_COMMENT(self, t): 287 def t_COMMENT(self, t):
287 r'(/\*(.|\n)*?\*/)|(//.*(\n[ \t]*//.*)*)' 288 r'(/\*(.|\n)*?\*/)|(//.*(\n[ \t]*//.*)*)'
288 pass 289 pass
289 290
290 def t_error(self, t): 291 def t_error(self, t):
291 msg = 'Illegal character %s' % repr(t.value[0]) 292 msg = 'Illegal character %s' % repr(t.value[0])
292 self._error(msg, t) 293 self._error(msg, t)
OLDNEW
« no previous file with comments | « mojo/public/tools/bindings/pylib/mojom/generate/module.py ('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