| OLD | NEW |
| 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 """ Parser for PPAPI IDL """ | 6 """ Parser for PPAPI IDL """ |
| 7 | 7 |
| 8 # | 8 # |
| 9 # IDL Parser | 9 # IDL Parser |
| 10 # | 10 # |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 def p_UnrestrictedFloatType(self, p): | 232 def p_UnrestrictedFloatType(self, p): |
| 233 """ """ | 233 """ """ |
| 234 pass | 234 pass |
| 235 | 235 |
| 236 def p_null(self, p): | 236 def p_null(self, p): |
| 237 """ """ | 237 """ """ |
| 238 pass | 238 pass |
| 239 | 239 |
| 240 # We only support: | 240 # We only support: |
| 241 # [ identifier ] | 241 # [ identifier ] |
| 242 # [ identifier = identifier ] | |
| 243 # [ identifier ( ArgumentList )] | 242 # [ identifier ( ArgumentList )] |
| 244 # [ identifier ( ValueList )] | 243 # [ identifier ( ValueList )] |
| 244 # [ identifier = identifier ] |
| 245 # [ identifier = ( IdentifierList )] |
| 246 # [ identifier = ConstValue ] |
| 245 # [ identifier = identifier ( ArgumentList )] | 247 # [ identifier = identifier ( ArgumentList )] |
| 246 # [51] map directly to 74-77 | 248 # [51] map directly to 74-77 |
| 247 # [52-54, 56] are unsupported | 249 # [52-54, 56] are unsupported |
| 248 def p_ExtendedAttribute(self, p): | 250 def p_ExtendedAttribute(self, p): |
| 249 """ExtendedAttribute : ExtendedAttributeNoArgs | 251 """ExtendedAttribute : ExtendedAttributeNoArgs |
| 250 | ExtendedAttributeArgList | 252 | ExtendedAttributeArgList |
| 251 | ExtendedAttributeValList | 253 | ExtendedAttributeValList |
| 252 | ExtendedAttributeIdent | 254 | ExtendedAttributeIdent |
| 255 | ExtendedAttributeIdentList |
| 253 | ExtendedAttributeIdentConst | 256 | ExtendedAttributeIdentConst |
| 254 | ExtendedAttributeNamedArgList""" | 257 | ExtendedAttributeNamedArgList""" |
| 255 p[0] = p[1] | 258 p[0] = p[1] |
| 256 | 259 |
| 257 def p_ExtendedAttributeValList(self, p): | 260 def p_ExtendedAttributeValList(self, p): |
| 258 """ExtendedAttributeValList : identifier '(' ValueList ')'""" | 261 """ExtendedAttributeValList : identifier '(' ValueList ')'""" |
| 259 arguments = self.BuildProduction('Values', p, 2, p[3]) | 262 arguments = self.BuildProduction('Values', p, 2, p[3]) |
| 260 p[0] = self.BuildNamed('ExtAttribute', p, 1, arguments) | 263 p[0] = self.BuildNamed('ExtAttribute', p, 1, arguments) |
| 261 | 264 |
| 262 def p_ValueList(self, p): | 265 def p_ValueList(self, p): |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 print '\n'.join(ast.Tree(accept_props=['PROD', 'TYPE', 'VALUE'])) | 298 print '\n'.join(ast.Tree(accept_props=['PROD', 'TYPE', 'VALUE'])) |
| 296 if errors: | 299 if errors: |
| 297 print '\nFound %d errors.\n' % errors | 300 print '\nFound %d errors.\n' % errors |
| 298 | 301 |
| 299 | 302 |
| 300 return errors | 303 return errors |
| 301 | 304 |
| 302 | 305 |
| 303 if __name__ == '__main__': | 306 if __name__ == '__main__': |
| 304 sys.exit(main(sys.argv[1:])) | 307 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |