| OLD | NEW |
| 1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 def p_ExtendedAttribute(self, p): | 301 def p_ExtendedAttribute(self, p): |
| 302 """ExtendedAttribute : ExtendedAttributeNoArgs | 302 """ExtendedAttribute : ExtendedAttributeNoArgs |
| 303 | ExtendedAttributeArgList | 303 | ExtendedAttributeArgList |
| 304 | ExtendedAttributeIdent | 304 | ExtendedAttributeIdent |
| 305 | ExtendedAttributeIdentList | 305 | ExtendedAttributeIdentList |
| 306 | ExtendedAttributeNamedArgList | 306 | ExtendedAttributeNamedArgList |
| 307 | ExtendedAttributeStringLiteral | 307 | ExtendedAttributeStringLiteral |
| 308 | ExtendedAttributeStringLiteralList""" | 308 | ExtendedAttributeStringLiteralList""" |
| 309 p[0] = p[1] | 309 p[0] = p[1] |
| 310 | 310 |
| 311 # [59] | |
| 312 # FIXME: Upstream UnionType | |
| 313 def p_UnionType(self, p): | |
| 314 """UnionType : '(' UnionMemberType OR UnionMemberType UnionMemberTypes '
)'""" | |
| 315 members = ListFromConcat(p[2], p[4], p[5]) | |
| 316 p[0] = self.BuildProduction('UnionType', p, 1, members) | |
| 317 | |
| 318 # [60] | |
| 319 def p_UnionMemberType(self, p): | |
| 320 """UnionMemberType : NonAnyType | |
| 321 | UnionType TypeSuffix | |
| 322 | ANY '[' ']' TypeSuffix""" | |
| 323 if len(p) == 2: | |
| 324 p[0] = self.BuildProduction('Type', p, 1, p[1]) | |
| 325 elif len(p) == 3: | |
| 326 p[0] = self.BuildProduction('Type', p, 1, ListFromConcat(p[1], p[2])
) | |
| 327 else: | |
| 328 any_node = ListFromConcat(self.BuildProduction('Any', p, 1), p[4]) | |
| 329 p[0] = self.BuildProduction('Type', p, 1, any_node) | |
| 330 | |
| 331 # [61] | |
| 332 def p_UnionMemberTypes(self, p): | |
| 333 """UnionMemberTypes : OR UnionMemberType UnionMemberTypes | |
| 334 |""" | |
| 335 if len(p) > 2: | |
| 336 p[0] = ListFromConcat(p[2], p[3]) | |
| 337 | |
| 338 # [70] Override base parser to remove non-standard sized array | 311 # [70] Override base parser to remove non-standard sized array |
| 339 # FIXME: Upstream | 312 # FIXME: Upstream |
| 340 def p_TypeSuffix(self, p): | 313 def p_TypeSuffix(self, p): |
| 341 """TypeSuffix : '[' ']' TypeSuffix | 314 """TypeSuffix : '[' ']' TypeSuffix |
| 342 | '?' TypeSuffixStartingWithArray | 315 | '?' TypeSuffixStartingWithArray |
| 343 |""" | 316 |""" |
| 344 if len(p) == 4: | 317 if len(p) == 4: |
| 345 p[0] = self.BuildProduction('Array', p, 1, p[3]) | 318 p[0] = self.BuildProduction('Array', p, 1, p[3]) |
| 346 elif len(p) == 3: | 319 elif len(p) == 3: |
| 347 p[0] = ListFromConcat(self.BuildTrue('NULLABLE'), p[2]) | 320 p[0] = ListFromConcat(self.BuildTrue('NULLABLE'), p[2]) |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 return 1 | 420 return 1 |
| 448 blink_idl_lexer.main(argv) | 421 blink_idl_lexer.main(argv) |
| 449 # Important: rewrite_tables=True causes the cache file to be deleted if it | 422 # Important: rewrite_tables=True causes the cache file to be deleted if it |
| 450 # exists, thus making sure that PLY doesn't load it instead of regenerating | 423 # exists, thus making sure that PLY doesn't load it instead of regenerating |
| 451 # the parse table. | 424 # the parse table. |
| 452 parser = BlinkIDLParser(outputdir=outputdir, rewrite_tables=True) | 425 parser = BlinkIDLParser(outputdir=outputdir, rewrite_tables=True) |
| 453 | 426 |
| 454 | 427 |
| 455 if __name__ == '__main__': | 428 if __name__ == '__main__': |
| 456 sys.exit(main(sys.argv)) | 429 sys.exit(main(sys.argv)) |
| OLD | NEW |