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

Side by Side Diff: ppapi/generators/idl_lexer.py

Issue 9348029: Make inline c blocks non-greedy, and use to add pragma pack to gamepad structure (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: temporarily disable static assert for 2 sided roll Created 8 years, 10 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
« no previous file with comments | « ppapi/c/dev/ppb_gamepad_dev.h ('k') | webkit/plugins/ppapi/ppapi_plugin_instance.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """ Lexer for PPAPI IDL """ 6 """ Lexer for PPAPI IDL """
7 7
8 # 8 #
9 # IDL Lexer 9 # IDL Lexer
10 # 10 #
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 return t 115 return t
116 116
117 # A C or C++ style comment: /* xxx */ or // 117 # A C or C++ style comment: /* xxx */ or //
118 def t_COMMENT(self, t): 118 def t_COMMENT(self, t):
119 r'(/\*(.|\n)*?\*/)|(//.*)' 119 r'(/\*(.|\n)*?\*/)|(//.*)'
120 self.AddLines(t.value.count('\n')) 120 self.AddLines(t.value.count('\n'))
121 return t 121 return t
122 122
123 # Return a "preprocessor" inline block 123 # Return a "preprocessor" inline block
124 def t_INLINE(self, t): 124 def t_INLINE(self, t):
125 r'\#inline (.|\n)*\#endinl.*' 125 r'\#inline (.|\n)*?\#endinl.*'
126 self.AddLines(t.value.count('\n')) 126 self.AddLines(t.value.count('\n'))
127 return t 127 return t
128 128
129 # A symbol or keyword. 129 # A symbol or keyword.
130 def t_KEYWORD_SYMBOL(self, t): 130 def t_KEYWORD_SYMBOL(self, t):
131 r'[A-Za-z][A-Za-z_0-9]*' 131 r'[A-Za-z][A-Za-z_0-9]*'
132 132
133 #All non-keywords are assumed to be symbols 133 #All non-keywords are assumed to be symbols
134 t.type = self.keywords.get(t.value, 'SYMBOL') 134 t.type = self.keywords.get(t.value, 'SYMBOL')
135 return t 135 return t
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 return -1 320 return -1
321 return 0 321 return 0
322 322
323 except lex.LexError as le: 323 except lex.LexError as le:
324 sys.stderr.write('%s\n' % str(le)) 324 sys.stderr.write('%s\n' % str(le))
325 return -1 325 return -1
326 326
327 327
328 if __name__ == '__main__': 328 if __name__ == '__main__':
329 sys.exit(Main(sys.argv[1:])) 329 sys.exit(Main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « ppapi/c/dev/ppb_gamepad_dev.h ('k') | webkit/plugins/ppapi/ppapi_plugin_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698