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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 | ExceptionField | 247 | ExceptionField |
248 | Attribute | 248 | Attribute |
249 | ExceptionOperation""" | 249 | ExceptionOperation""" |
250 # Standard is (no Attribute, no ExceptionOperation): | 250 # Standard is (no Attribute, no ExceptionOperation): |
251 # ExceptionMember : Const | 251 # ExceptionMember : Const |
252 # | ExceptionField | 252 # | ExceptionField |
253 # FIXME: In DOMException.idl, Attributes should be changed to | 253 # FIXME: In DOMException.idl, Attributes should be changed to |
254 # ExceptionFields, and Attribute removed from this rule. | 254 # ExceptionFields, and Attribute removed from this rule. |
255 p[0] = p[1] | 255 p[0] = p[1] |
256 | 256 |
257 # [b47.1] | 257 # [b47.1] FIXME: rename to ExceptionAttribute |
| 258 def p_Attribute(self, p): |
| 259 """Attribute : ReadOnly ATTRIBUTE Type identifier ';'""" |
| 260 p[0] = self.BuildNamed('Attribute', p, 4, |
| 261 ListFromConcat(p[1], p[3])) |
| 262 |
| 263 # [b47.2] |
258 def p_ExceptionOperation(self, p): | 264 def p_ExceptionOperation(self, p): |
259 """ExceptionOperation : Type identifier '(' ')' ';'""" | 265 """ExceptionOperation : Type identifier '(' ')' ';'""" |
260 # Needed to handle one case in DOMException.idl: | 266 # Needed to handle one case in DOMException.idl: |
261 # // Override in a Mozilla compatible format | 267 # // Override in a Mozilla compatible format |
262 # [NotEnumerable] DOMString toString(); | 268 # [NotEnumerable] DOMString toString(); |
263 # Limited form of Operation to prevent others from being added. | 269 # Limited form of Operation to prevent others from being added. |
264 # FIXME: Should be a stringifier instead. | 270 # FIXME: Should be a stringifier instead. |
265 p[0] = self.BuildNamed('ExceptionOperation', p, 2, p[1]) | 271 p[0] = self.BuildNamed('ExceptionOperation', p, 2, p[1]) |
266 | 272 |
267 # Extended attributes | 273 # Extended attributes |
268 # [b49] Override base parser: remove comment field, since comments stripped | 274 # [b49] Override base parser: remove comment field, since comments stripped |
269 # FIXME: Upstream | 275 # FIXME: Upstream |
270 def p_ExtendedAttributeList(self, p): | 276 def p_ExtendedAttributeList(self, p): |
271 """ExtendedAttributeList : '[' ExtendedAttribute ExtendedAttributes ']' | 277 """ExtendedAttributeList : '[' ExtendedAttribute ExtendedAttributes ']' |
272 | '[' ']' | 278 | '[' ']' |
273 | """ | 279 | """ |
274 if len(p) > 3: | 280 if len(p) > 3: |
275 items = ListFromConcat(p[2], p[3]) | 281 items = ListFromConcat(p[2], p[3]) |
276 p[0] = self.BuildProduction('ExtAttributes', p, 1, items) | 282 p[0] = self.BuildProduction('ExtAttributes', p, 1, items) |
277 | 283 |
| 284 # Error handling for ExtendedAttributeList. |
| 285 # We can't upstream this because we override ExtendedAttributeList. |
| 286 def p_ExtendedAttributeListError(self, p): |
| 287 """ExtendedAttributeList : '[' ExtendedAttribute ',' error""" |
| 288 p[0] = self.BuildError(p, "ExtendedAttributeList") |
| 289 |
278 # [b50] Allow optional trailing comma | 290 # [b50] Allow optional trailing comma |
279 # Blink-only, marked as WONTFIX in Web IDL spec: | 291 # Blink-only, marked as WONTFIX in Web IDL spec: |
280 # https://www.w3.org/Bugs/Public/show_bug.cgi?id=22156 | 292 # https://www.w3.org/Bugs/Public/show_bug.cgi?id=22156 |
281 def p_ExtendedAttributes(self, p): | 293 def p_ExtendedAttributes(self, p): |
282 """ExtendedAttributes : ',' ExtendedAttribute ExtendedAttributes | 294 """ExtendedAttributes : ',' ExtendedAttribute ExtendedAttributes |
283 | ',' | 295 | ',' |
284 |""" | 296 |""" |
285 if len(p) > 3: | 297 if len(p) > 3: |
286 p[0] = ListFromConcat(p[2], p[3]) | 298 p[0] = ListFromConcat(p[2], p[3]) |
287 | 299 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 return 1 | 447 return 1 |
436 blink_idl_lexer.main(argv) | 448 blink_idl_lexer.main(argv) |
437 # Important: rewrite_tables=True causes the cache file to be deleted if it | 449 # Important: rewrite_tables=True causes the cache file to be deleted if it |
438 # exists, thus making sure that PLY doesn't load it instead of regenerating | 450 # exists, thus making sure that PLY doesn't load it instead of regenerating |
439 # the parse table. | 451 # the parse table. |
440 parser = BlinkIDLParser(outputdir=outputdir, rewrite_tables=True) | 452 parser = BlinkIDLParser(outputdir=outputdir, rewrite_tables=True) |
441 | 453 |
442 | 454 |
443 if __name__ == '__main__': | 455 if __name__ == '__main__': |
444 sys.exit(main(sys.argv)) | 456 sys.exit(main(sys.argv)) |
OLD | NEW |