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

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

Issue 317073005: Mojom: Add 'default' keyword for initializing structs to non-null value. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 'HANDLE', 59 'HANDLE',
60 60
61 'IMPORT', 61 'IMPORT',
62 'MODULE', 62 'MODULE',
63 'STRUCT', 63 'STRUCT',
64 'INTERFACE', 64 'INTERFACE',
65 'ENUM', 65 'ENUM',
66 'CONST', 66 'CONST',
67 'TRUE', 67 'TRUE',
68 'FALSE', 68 'FALSE',
69 'DEFAULT',
69 ) 70 )
70 71
71 keyword_map = {} 72 keyword_map = {}
72 for keyword in keywords: 73 for keyword in keywords:
73 keyword_map[keyword.lower()] = keyword 74 keyword_map[keyword.lower()] = keyword
74 75
75 ## 76 ##
76 ## All the tokens recognized by the lexer 77 ## All the tokens recognized by the lexer
77 ## 78 ##
78 tokens = keywords + ( 79 tokens = keywords + (
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 return t 268 return t
268 269
269 # Ignore C and C++ style comments 270 # Ignore C and C++ style comments
270 def t_COMMENT(self, t): 271 def t_COMMENT(self, t):
271 r'(/\*(.|\n)*?\*/)|(//.*(\n[ \t]*//.*)*)' 272 r'(/\*(.|\n)*?\*/)|(//.*(\n[ \t]*//.*)*)'
272 t.lexer.lineno += t.value.count("\n") 273 t.lexer.lineno += t.value.count("\n")
273 274
274 def t_error(self, t): 275 def t_error(self, t):
275 msg = "Illegal character %s" % repr(t.value[0]) 276 msg = "Illegal character %s" % repr(t.value[0])
276 self._error(msg, t) 277 self._error(msg, t)
OLDNEW
« no previous file with comments | « mojo/public/tools/bindings/pylib/mojom/generate/generator.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