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

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

Issue 8586031: Convert a few ppapi dev interfaces to IDL. NaCl has tests for these (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clean up a bit more Created 9 years, 1 month 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
« no previous file with comments | « ppapi/generators/idl_c_proto.py ('k') | no next file » | 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/python 1 #!/usr/bin/python
2 # 2 #
3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """ Lexer for PPAPI IDL """ 7 """ Lexer for PPAPI IDL """
8 8
9 # 9 #
10 # IDL Lexer 10 # IDL Lexer
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 # Lex assumes any value or function in the form of 't_<TYPE>' represents a 90 # Lex assumes any value or function in the form of 't_<TYPE>' represents a
91 # regular expression where a match will emit a token of type <TYPE>. In the 91 # regular expression where a match will emit a token of type <TYPE>. In the
92 # case of a function, the function is called when a match is made. These 92 # case of a function, the function is called when a match is made. These
93 # definitions come from WebIDL. 93 # definitions come from WebIDL.
94 94
95 # 't_ignore' is a special match of items to ignore 95 # 't_ignore' is a special match of items to ignore
96 t_ignore = ' \t' 96 t_ignore = ' \t'
97 97
98 # Constant values 98 # Constant values
99 t_FLOAT = r'-?(\d+\.\d*|\d*\.\d+)([Ee][+-]?\d+)?|-?\d+[Ee][+-]?\d+' 99 t_FLOAT = r'-?(\d+\.\d*|\d*\.\d+)([Ee][+-]?\d+)?|-?\d+[Ee][+-]?\d+'
100 t_INT = r'-?[0-9]+' 100 t_INT = r'-?[0-9]+[uU]?'
101 t_OCT = r'-?0[0-7]+' 101 t_OCT = r'-?0[0-7]+'
102 t_HEX = r'-?0[Xx][0-9A-Fa-f]+' 102 t_HEX = r'-?0[Xx][0-9A-Fa-f]+'
103 t_LSHIFT = r'<<' 103 t_LSHIFT = r'<<'
104 t_RSHIFT = r'>>' 104 t_RSHIFT = r'>>'
105 105
106 # A line ending '\n', we use this to increment the line number 106 # A line ending '\n', we use this to increment the line number
107 def t_LINE_END(self, t): 107 def t_LINE_END(self, t):
108 r'\n+' 108 r'\n+'
109 self.AddLines(len(t.value)) 109 self.AddLines(len(t.value))
110 110
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 if TestExpect(tokens): 323 if TestExpect(tokens):
324 return -1 324 return -1
325 return 0 325 return 0
326 326
327 except lex.LexError as le: 327 except lex.LexError as le:
328 sys.stderr.write('%s\n' % str(le)) 328 sys.stderr.write('%s\n' % str(le))
329 return -1 329 return -1
330 330
331 if __name__ == '__main__': 331 if __name__ == '__main__':
332 sys.exit(Main(sys.argv[1:])) 332 sys.exit(Main(sys.argv[1:]))
333
OLDNEW
« no previous file with comments | « ppapi/generators/idl_c_proto.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698