| 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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 # FIXME: Upstream | 326 # FIXME: Upstream |
| 327 def p_TypeSuffix(self, p): | 327 def p_TypeSuffix(self, p): |
| 328 """TypeSuffix : '[' ']' TypeSuffix | 328 """TypeSuffix : '[' ']' TypeSuffix |
| 329 | '?' TypeSuffixStartingWithArray | 329 | '?' TypeSuffixStartingWithArray |
| 330 |""" | 330 |""" |
| 331 if len(p) == 4: | 331 if len(p) == 4: |
| 332 p[0] = self.BuildProduction('Array', p, 1, p[3]) | 332 p[0] = self.BuildProduction('Array', p, 1, p[3]) |
| 333 elif len(p) == 3: | 333 elif len(p) == 3: |
| 334 p[0] = ListFromConcat(self.BuildTrue('NULLABLE'), p[2]) | 334 p[0] = ListFromConcat(self.BuildTrue('NULLABLE'), p[2]) |
| 335 | 335 |
| 336 # [b76.1] Add support for compound Extended Attribute values (A&B and A|B) | 336 # [b94] Add support for OR Extended Attribute values "A|B" |
| 337 def p_ExtendedAttributeIdentList(self, p): | 337 def p_ExtendedAttributeIdentList(self, p): |
| 338 """ExtendedAttributeIdentList : identifier '=' identifier '&' IdentAndLi
st | 338 """ExtendedAttributeIdentList : identifier '=' '(' IdentifierList ')' |
| 339 | identifier '=' identifier '|' IdentOrLis
t""" | 339 | identifier '=' identifier '|' IdentOrLis
t""" |
| 340 value = self.BuildAttribute('VALUE', p[3] + p[4] + p[5]) | 340 if type(p[4]) is list: |
| 341 value = self.BuildAttribute('VALUE', ','.join(p[4])) |
| 342 else: |
| 343 value = self.BuildAttribute('VALUE', p[3] + p[4] + p[5]) |
| 341 p[0] = self.BuildNamed('ExtAttribute', p, 1, value) | 344 p[0] = self.BuildNamed('ExtAttribute', p, 1, value) |
| 342 | 345 |
| 343 # [b76.2] A&B&C | 346 # [b94.1] A|B|C |
| 344 def p_IdentAndList(self, p): | |
| 345 """IdentAndList : identifier '&' IdentAndList | |
| 346 | identifier""" | |
| 347 if len(p) > 3: | |
| 348 p[0] = p[1] + p[2] + p[3] | |
| 349 else: | |
| 350 p[0] = p[1] | |
| 351 | |
| 352 # [b76.3] A|B|C | |
| 353 def p_IdentOrList(self, p): | 347 def p_IdentOrList(self, p): |
| 354 """IdentOrList : identifier '|' IdentOrList | 348 """IdentOrList : identifier '|' IdentOrList |
| 355 | identifier""" | 349 | identifier""" |
| 356 if len(p) > 3: | 350 if len(p) > 3: |
| 357 p[0] = p[1] + p[2] + p[3] | 351 p[0] = p[1] + p[2] + p[3] |
| 358 else: | 352 else: |
| 359 p[0] = p[1] | 353 p[0] = p[1] |
| 360 | 354 |
| 361 # Blink extension: Add support for compound Extended Attribute values over s
tring literals ("A"|"B") | 355 # Blink extension: Add support for compound Extended Attribute values over s
tring literals ("A"|"B") |
| 362 def p_ExtendedAttributeStringLiteralList(self, p): | 356 def p_ExtendedAttributeStringLiteralList(self, p): |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 return 1 | 443 return 1 |
| 450 blink_idl_lexer.main(argv) | 444 blink_idl_lexer.main(argv) |
| 451 # Important: rewrite_tables=True causes the cache file to be deleted if it | 445 # Important: rewrite_tables=True causes the cache file to be deleted if it |
| 452 # exists, thus making sure that PLY doesn't load it instead of regenerating | 446 # exists, thus making sure that PLY doesn't load it instead of regenerating |
| 453 # the parse table. | 447 # the parse table. |
| 454 parser = BlinkIDLParser(outputdir=outputdir, rewrite_tables=True) | 448 parser = BlinkIDLParser(outputdir=outputdir, rewrite_tables=True) |
| 455 | 449 |
| 456 | 450 |
| 457 if __name__ == '__main__': | 451 if __name__ == '__main__': |
| 458 sys.exit(main(sys.argv)) | 452 sys.exit(main(sys.argv)) |
| OLD | NEW |