• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 Dictionary 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 *Dictionary(MyDict)
35 */
36dictionary MyDict { };
37
38/* TREE
39 *Dictionary(MyDictInherit)
40 *  Inherit(Foo)
41 */
42dictionary MyDictInherit : Foo {};
43
44/* TREE
45 *Dictionary(MyDictPartial)
46 */
47partial dictionary MyDictPartial { };
48
49/* ERROR Unexpected ":" after identifier "MyDictInherit". */
50partial dictionary MyDictInherit : Foo {};
51
52/* TREE
53 *Dictionary(MyDictBig)
54 *  Key(setString)
55 *    Type()
56 *      PrimitiveType(DOMString)
57 *    Default(Foo)
58 *  Key(setLong)
59 *    Type()
60 *      PrimitiveType(unsigned long long)
61 *    Default(123)
62 *  Key(unsetLong)
63 *    Type()
64 *      PrimitiveType(long)
65 */
66dictionary MyDictBig {
67  DOMString setString = "Foo";
68  unsigned long long setLong = 123;
69  long unsetLong;
70};
71
72
73/* ERROR Unexpected "{" after keyword "dictionary". */
74dictionary {
75  DOMString? setString = null;
76};
77
78
79/* ERROR Unexpected identifier "NoColon" after identifier "ForParent". */
80dictionary ForParent NoColon {
81  DOMString? setString = null;
82};
83
84/* TREE
85 *Dictionary(MyDictNull)
86 *  Key(setString)
87 *    Type()
88 *      PrimitiveType(DOMString)
89 *    Default(NULL)
90 */
91dictionary MyDictNull {
92  DOMString? setString = null;
93};
94
95
96