Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / tools / idl_parser / test_parser / enum_web.idl
blobe3107c0ae41e64bd37e36220aef656b94c8a4984
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. */
5 /* Test Enum productions
7 Run with --test to generate an AST and verify that all comments accurately
8 reflect the state of the Nodes.
10 BUILD Type(Name)
11 This comment signals that a node of type <Type> is created with the
12 name <Name>.
14 ERROR Error String
15 This comment signals that a error of <Error String> is generated. The error
16 is not assigned to a node, but are expected in order.
18 PROP Key=Value
19 This comment signals that a property has been set on the Node such that
20 <Key> = <Value>.
22 TREE
23 Type(Name)
24 Type(Name)
25 Type(Name)
26 Type(Name)
27 ...
28 This comment signals that a tree of nodes matching the BUILD comment
29 symatics should exist. This is an exact match.
32 /* TREE
33 *Enum(MealType1)
34 * EnumItem(rice)
35 * EnumItem(noodles)
36 * EnumItem(other)
38 enum MealType1 {
39 /* BUILD EnumItem (rice) */
40 "rice",
41 /* BUILD EnumItem (noodles) */
42 "noodles",
43 /* BUILD EnumItem(other) */
44 "other"
47 /* BUILD Error(Enum missing name.) */
48 /* ERROR Enum missing name. */
49 enum {
50 "rice",
51 "noodles",
52 "other"
55 /* TREE
56 *Enum(MealType2)
57 * EnumItem(rice)
58 * EnumItem(noodles)
59 * EnumItem(other)
61 enum MealType2 {
62 /* BUILD EnumItem(rice) */
63 "rice",
64 /* BUILD EnumItem(noodles) */
65 "noodles",
66 /* BUILD EnumItem(other) */
67 "other"
70 /* TREE
71 *Enum(TrailingComma)
72 * EnumItem(rice)
73 * EnumItem(noodles)
74 * EnumItem(other)
76 enum TrailingComma {
77 "rice",
78 "noodles",
79 "other",
82 /* BUILD Error(Unexpected string "noodles" after string "rice".) */
83 /* ERROR Unexpected string "noodles" after string "rice". */
84 enum MissingComma {
85 "rice"
86 "noodles",
87 "other"
90 /* BUILD Error(Unexpected "," after ",".) */
91 /* ERROR Unexpected "," after ",". */
92 enum ExtraComma {
93 "rice",
94 "noodles",
95 ,"other",
98 /* BUILD Error(Unexpected keyword "interface" after "{".) */
99 /* ERROR Unexpected keyword "interface" after "{". */
100 enum ExtraComma {
101 interface,
102 "noodles",
103 ,"other",
106 /* BUILD Error(Unexpected identifier "somename" after "{".) */
107 /* ERROR Unexpected identifier "somename" after "{". */
108 enum ExtraComma {
109 somename,
110 "noodles",
111 ,"other",
114 /* BUILD Enum(MealType3) */
115 enum MealType3 {
116 /* BUILD EnumItem(rice) */
117 "rice",
118 /* BUILD EnumItem(noodles) */
119 "noodles",
120 /* BUILD EnumItem(other) */
121 "other"