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

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

Issue 329853005: IDL parser: align with current Web IDL specification (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: 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 | « no previous file | tools/idl_parser/idl_node.py » ('j') | tools/idl_parser/idl_parser.py » ('J')
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 ] 60 ]
61 61
62 # 'keywords' is a map of string to token type. All tokens matching 62 # 'keywords' is a map of string to token type. All tokens matching
63 # KEYWORD_OR_SYMBOL are matched against keywords dictionary, to determine 63 # KEYWORD_OR_SYMBOL are matched against keywords dictionary, to determine
64 # if the token is actually a keyword. 64 # if the token is actually a keyword.
65 keywords = { 65 keywords = {
66 'any' : 'ANY', 66 'any' : 'ANY',
67 'attribute' : 'ATTRIBUTE', 67 'attribute' : 'ATTRIBUTE',
68 'boolean' : 'BOOLEAN', 68 'boolean' : 'BOOLEAN',
69 'byte' : 'BYTE', 69 'byte' : 'BYTE',
70 'ByteString' : 'BYTESTRING',
70 'callback' : 'CALLBACK', 71 'callback' : 'CALLBACK',
71 'const' : 'CONST', 72 'const' : 'CONST',
72 'creator' : 'CREATOR', 73 'creator' : 'CREATOR',
73 'Date' : 'DATE', 74 'Date' : 'DATE',
74 'deleter' : 'DELETER', 75 'deleter' : 'DELETER',
75 'dictionary' : 'DICTIONARY', 76 'dictionary' : 'DICTIONARY',
76 'DOMString' : 'DOMSTRING', 77 'DOMString' : 'DOMSTRING',
77 'double' : 'DOUBLE', 78 'double' : 'DOUBLE',
78 'enum' : 'ENUM', 79 'enum' : 'ENUM',
79 'false' : 'FALSE', 80 'false' : 'FALSE',
80 'float' : 'FLOAT', 81 'float' : 'FLOAT',
81 'exception' : 'EXCEPTION', 82 'exception' : 'EXCEPTION',
82 'getter': 'GETTER', 83 'getter': 'GETTER',
83 'implements' : 'IMPLEMENTS', 84 'implements' : 'IMPLEMENTS',
84 'Infinity' : 'INFINITY', 85 'Infinity' : 'INFINITY',
85 'inherit' : 'INHERIT', 86 'inherit' : 'INHERIT',
86 'interface' : 'INTERFACE', 87 'interface' : 'INTERFACE',
88 #'iterator': 'ITERATOR',
noelallen1 2014/06/12 19:33:36 Did you mean to leave this in?
Jens Widell 2014/06/13 06:19:12 Not really. Same here as with the commented out pr
87 'legacycaller' : 'LEGACYCALLER', 89 'legacycaller' : 'LEGACYCALLER',
88 'long' : 'LONG', 90 'long' : 'LONG',
89 'Nan' : 'NAN', 91 'Nan' : 'NAN',
90 'null' : 'NULL', 92 'null' : 'NULL',
91 'object' : 'OBJECT', 93 'object' : 'OBJECT',
92 'octet' : 'OCTET', 94 'octet' : 'OCTET',
93 'optional' : 'OPTIONAL', 95 'optional' : 'OPTIONAL',
94 'or' : 'OR', 96 'or' : 'OR',
95 'partial' : 'PARTIAL', 97 'partial' : 'PARTIAL',
96 'readonly' : 'READONLY', 98 'readonly' : 'READONLY',
99 'RegExp' : 'REGEXP',
97 'sequence' : 'SEQUENCE', 100 'sequence' : 'SEQUENCE',
101 'serializer' : 'SERIALIZER',
98 'setter': 'SETTER', 102 'setter': 'SETTER',
99 'short' : 'SHORT', 103 'short' : 'SHORT',
100 'static' : 'STATIC', 104 'static' : 'STATIC',
101 'stringifier' : 'STRINGIFIER', 105 'stringifier' : 'STRINGIFIER',
102 'typedef' : 'TYPEDEF', 106 'typedef' : 'TYPEDEF',
103 'true' : 'TRUE', 107 'true' : 'TRUE',
104 'unsigned' : 'UNSIGNED', 108 'unsigned' : 'UNSIGNED',
105 'unrestricted' : 'UNRESTRICTED', 109 'unrestricted' : 'UNRESTRICTED',
106 'void' : 'VOID' 110 'void' : 'VOID'
107 } 111 }
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 self.tokens = [] 280 self.tokens = []
277 self._AddTokens(IDLLexer.tokens) 281 self._AddTokens(IDLLexer.tokens)
278 self._AddKeywords(IDLLexer.keywords) 282 self._AddKeywords(IDLLexer.keywords)
279 self._lexobj = None 283 self._lexobj = None
280 self.last = None 284 self.last = None
281 self.lines = None 285 self.lines = None
282 286
283 # If run by itself, attempt to build the lexer 287 # If run by itself, attempt to build the lexer
284 if __name__ == '__main__': 288 if __name__ == '__main__':
285 lexer_object = IDLLexer() 289 lexer_object = IDLLexer()
OLDNEW
« no previous file with comments | « no previous file | tools/idl_parser/idl_node.py » ('j') | tools/idl_parser/idl_parser.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698