1/* Copyright (c) 2013 The Chromium Authors. All rights reserved.
2   Use of this source code is governed by a BSD-style license that can be
3  found in the LICENSE file. */
4
5/* Test Interface productions
6
7Run with --test to generate an AST and verify that all comments accurately
8reflect the state of the Nodes.
9
10BUILD Type(Name)
11This comment signals that a node of type <Type> is created with the
12name <Name>.
13
14ERROR Error String
15This comment signals that a error of <Error String> is generated.  The error
16is not assigned to a node, but are expected in order.
17
18PROP Key=Value
19This comment signals that a property has been set on the Node such that
20<Key> = <Value>.
21
22TREE
23Type(Name)
24  Type(Name)
25  Type(Name)
26    Type(Name)
27    ...
28This comment signals that a tree of nodes matching the BUILD comment
29symatics should exist.  This is an exact match.
30*/
31
32
33/* TREE
34 *Interface(MyIFace)
35 */
36interface MyIFace { };
37
38/* TREE
39 *Interface(MyIFaceInherit)
40 *  Inherit(Foo)
41 */
42interface MyIFaceInherit : Foo {};
43
44/* TREE
45 *Interface(MyIFacePartial)
46 */
47partial interface MyIFacePartial { };
48
49/* ERROR Unexpected ":" after identifier "MyIFaceInherit". */
50partial interface MyIFaceInherit : Foo {};
51
52/* TREE
53 *Interface(MyIFaceBig)
54 *  Const(setString)
55 *    PrimitiveType(DOMString)
56 *    Value(NULL)
57 */
58interface MyIFaceBig {
59  const DOMString? setString = null;
60};
61
62/* TREE
63 *Interface(MyIFaceBig2)
64 *  Const(nullValue)
65 *    PrimitiveType(DOMString)
66 *    Value(NULL)
67 *  Const(longValue)
68 *    PrimitiveType(long)
69 *    Value(123)
70 *  Const(longValue2)
71 *    PrimitiveType(long long)
72 *    Value(123)
73 *  Attribute(myString)
74 *    Type()
75 *      PrimitiveType(DOMString)
76 *  Attribute(readOnlyString)
77 *    Type()
78 *      PrimitiveType(DOMString)
79 *  Operation(myFunction)
80 *    Type()
81 *      PrimitiveType(void)
82 *    Arguments()
83 *      Argument(myLong)
84 *        Type()
85 *          PrimitiveType(long long)
86 */
87interface MyIFaceBig2 {
88  const DOMString? nullValue = null;
89  const long longValue = 123;
90  const long long longValue2 = 123;
91  attribute DOMString myString;
92  readonly attribute DOMString readOnlyString;
93  void myFunction(long long myLong);
94};
95
96
97/* TREE
98 *Interface(MyIFaceSpecials)
99 *  Operation(set)
100 *    Type()
101 *      PrimitiveType(void)
102 *    Arguments()
103 *      Argument(property)
104 *        Type()
105 *          PrimitiveType(DOMString)
106 *  Operation(_unnamed_)
107 *    Type()
108 *      PrimitiveType(double)
109 *    Arguments()
110 *      Argument(property)
111 *        Type()
112 *          PrimitiveType(DOMString)
113 *  Operation(GetFiveSix)
114 *    Type()
115 *      PrimitiveType(long long)
116 *      Array(5)
117 *        Array(6)
118 *    Arguments()
119 *      Argument(arg)
120 *        Type()
121 *          Typeref(SomeType)
122 */
123interface MyIFaceSpecials {
124  setter creator void set(DOMString property);
125  getter double (DOMString property);
126  long long [5][6] GetFiveSix(SomeType arg);
127};
128