OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 // IDL grammar variants. | 5 // IDL grammar variants. |
6 const int WEBIDL_SYNTAX = 0; | 6 const int WEBIDL_SYNTAX = 0; |
7 const int WEBKIT_SYNTAX = 1; | 7 const int WEBKIT_SYNTAX = 1; |
8 const int FREMONTCUT_SYNTAX = 2; | 8 const int FREMONTCUT_SYNTAX = 2; |
9 | 9 |
10 /** | 10 /** |
(...skipping 16 matching lines...) Expand all Loading... |
27 class IDLModule extends IDLNode { | 27 class IDLModule extends IDLNode { |
28 String id; | 28 String id; |
29 List interfaces; | 29 List interfaces; |
30 List typedefs; | 30 List typedefs; |
31 List implementsStatements; | 31 List implementsStatements; |
32 | 32 |
33 IDLModule(String this.id, IDLExtAttrs extAttrs, IDLAnnotations annotations, | 33 IDLModule(String this.id, IDLExtAttrs extAttrs, IDLAnnotations annotations, |
34 List<IDLNode> elements) { | 34 List<IDLNode> elements) { |
35 setExtAttrs(extAttrs); | 35 setExtAttrs(extAttrs); |
36 this.annotations = annotations; | 36 this.annotations = annotations; |
37 this.interfaces = elements.filter((e) => e is IDLInterface); | 37 this.interfaces = elements.where((e) => e is IDLInterface).toList(); |
38 this.typedefs = elements.filter((e) => e is IDLTypeDef); | 38 this.typedefs = elements.where((e) => e is IDLTypeDef).toList(); |
39 this.implementsStatements = | 39 this.implementsStatements = |
40 elements.filter((e) => e is IDLImplementsStatement); | 40 elements.where((e) => e is IDLImplementsStatement).toList(); |
41 } | 41 } |
42 | 42 |
43 toString() => '<IDLModule $id $extAttrs $annotations>'; | 43 toString() => '<IDLModule $id $extAttrs $annotations>'; |
44 } | 44 } |
45 | 45 |
46 class IDLNode { | 46 class IDLNode { |
47 IDLExtAttrs extAttrs; | 47 IDLExtAttrs extAttrs; |
48 IDLAnnotations annotations; | 48 IDLAnnotations annotations; |
49 IDLNode(); | 49 IDLNode(); |
50 | 50 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 bool isSupplemental; | 94 bool isSupplemental; |
95 bool isNoInterfaceObject; | 95 bool isNoInterfaceObject; |
96 bool isFcSuppressed; | 96 bool isFcSuppressed; |
97 | 97 |
98 IDLInterface(String this.id, IDLExtAttrs ea, IDLAnnotations ann, | 98 IDLInterface(String this.id, IDLExtAttrs ea, IDLAnnotations ann, |
99 List this.parents, List members) { | 99 List this.parents, List members) { |
100 setExtAttrs(ea); | 100 setExtAttrs(ea); |
101 this.annotations = ann; | 101 this.annotations = ann; |
102 if (this.parents == null) this.parents = []; | 102 if (this.parents == null) this.parents = []; |
103 | 103 |
104 operations = members.filter((e) => e is IDLOperation); | 104 operations = members.where((e) => e is IDLOperation).toList(); |
105 attributes = members.filter((e) => e is IDLAttribute); | 105 attributes = members.where((e) => e is IDLAttribute).toList(); |
106 constants = members.filter((e) => e is IDLConstant); | 106 constants = members.where((e) => e is IDLConstant).toList(); |
107 snippets = members.filter((e) => e is IDLSnippet); | 107 snippets = members.where((e) => e is IDLSnippet).toList(); |
108 | 108 |
109 isSupplemental = extAttrs.has('Supplemental'); | 109 isSupplemental = extAttrs.has('Supplemental'); |
110 isNoInterfaceObject = extAttrs.has('NoInterfaceObject'); | 110 isNoInterfaceObject = extAttrs.has('NoInterfaceObject'); |
111 isFcSuppressed = extAttrs.has('Suppressed'); | 111 isFcSuppressed = extAttrs.has('Suppressed'); |
112 } | 112 } |
113 | 113 |
114 toString() => '<IDLInterface $id $extAttrs $annotations>'; | 114 toString() => '<IDLInterface $id $extAttrs $annotations>'; |
115 } | 115 } |
116 | 116 |
117 class IDLMember extends IDLNode { | 117 class IDLMember extends IDLNode { |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 OR([MANY(CHAR(' \t\r\n')), | 540 OR([MANY(CHAR(' \t\r\n')), |
541 ['//', MANY0([NOT(CHAR('\r\n')), CHAR()])], | 541 ['//', MANY0([NOT(CHAR('\r\n')), CHAR()])], |
542 ['#', MANY0([NOT(CHAR('\r\n')), CHAR()])], | 542 ['#', MANY0([NOT(CHAR('\r\n')), CHAR()])], |
543 ['/*', MANY0([NOT('*/'), CHAR()]), '*/']]); | 543 ['/*', MANY0([NOT('*/'), CHAR()]), '*/']]); |
544 | 544 |
545 // Top level - at least one definition. | 545 // Top level - at least one definition. |
546 return MANY(Definition); | 546 return MANY(Definition); |
547 | 547 |
548 } | 548 } |
549 } | 549 } |
OLD | NEW |