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

Side by Side Diff: tools/idl_parser/idl_ppapi_lexer.py

Issue 329853005: IDL parser: align with current Web IDL specification (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: extend commentary 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
« no previous file with comments | « tools/idl_parser/idl_parser.py ('k') | tools/idl_parser/idl_ppapi_parser.py » ('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) 2013 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2013 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 The lexer uses the PLY library to build a tokenizer which understands both 8 The lexer uses the PLY library to build a tokenizer which understands both
9 WebIDL and Pepper tokens. 9 WebIDL and Pepper tokens.
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 self._AddKeywords(['uint8_t', 'uint16_t', 'uint32_t', 'uint64_t']) 51 self._AddKeywords(['uint8_t', 'uint16_t', 'uint32_t', 'uint64_t'])
52 self._AddKeywords(['double_t', 'float_t']) 52 self._AddKeywords(['double_t', 'float_t'])
53 53
54 # Add handle types 54 # Add handle types
55 self._AddKeywords(['handle_t', 'PP_FileHandle']) 55 self._AddKeywords(['handle_t', 'PP_FileHandle'])
56 56
57 # Add pointer types (void*, char*, const char*, const void*) 57 # Add pointer types (void*, char*, const char*, const void*)
58 self._AddKeywords(['mem_t', 'str_t', 'cstr_t', 'interface_t']) 58 self._AddKeywords(['mem_t', 'str_t', 'cstr_t', 'interface_t'])
59 59
60 # Remove JS types 60 # Remove JS types
61 self._DelKeywords(['boolean', 'byte', 'Date', 'DOMString', 'double', 61 self._DelKeywords(['boolean', 'byte', 'ByteString', 'Date', 'DOMString',
62 'float', 'long', 'object', 'octet', 'short', 'unsigned']) 62 'double', 'float', 'long', 'object', 'octet', 'RegExp',
63 'short', 'unsigned'])
63 64
64 65
65 # If run by itself, attempt to build the lexer 66 # If run by itself, attempt to build the lexer
66 if __name__ == '__main__': 67 if __name__ == '__main__':
67 lexer = IDLPPAPILexer() 68 lexer = IDLPPAPILexer()
68 lexer.Tokenize(open('test_parser/inline_ppapi.idl').read()) 69 lexer.Tokenize(open('test_parser/inline_ppapi.idl').read())
Nils Barth (inactive) 2014/06/17 05:11:55 For bonus points, could you replace this resource-
69 for tok in lexer.GetTokens(): 70 for tok in lexer.GetTokens():
70 print '\n' + str(tok) 71 print '\n' + str(tok)
OLDNEW
« no previous file with comments | « tools/idl_parser/idl_parser.py ('k') | tools/idl_parser/idl_ppapi_parser.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698