Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / tools / idl_parser / test_parser / enum_ppapi.idl
blob1b088b840098d9aea42c7ae4cace08ce0d6e1eb2
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 = 1,
66 /* BUILD EnumItem(other) */
67 other
70 /* BUILD Error(Unexpected identifier "noodles" after identifier "rice".) */
71 /* ERROR Unexpected identifier "noodles" after identifier "rice". */
72 enum MissingComma {
73 rice
74 noodles,
75 other
78 /* BUILD Error(Trailing comma in block.) */
79 /* ERROR Trailing comma in block. */
80 enum TrailingComma {
81 rice,
82 noodles,
83 other,
86 /* BUILD Error(Unexpected "," after ",".) */
87 /* ERROR Unexpected "," after ",". */
88 enum ExtraComma {
89 rice,
90 noodles,
91 ,other,
94 /* BUILD Error(Unexpected keyword "interface" after "{".) */
95 /* ERROR Unexpected keyword "interface" after "{". */
96 enum ExtraComma {
97 interface,
98 noodles,
99 ,other,
102 /* BUILD Error(Unexpected string "somename" after "{".) */
103 /* ERROR Unexpected string "somename" after "{". */
104 enum ExtraComma {
105 "somename",
106 noodles,
107 other,
110 /* BUILD Enum(MealType3) */
111 enum MealType3 {
112 /* BUILD EnumItem(rice) */
113 rice = 1 << 1,
114 /* BUILD EnumItem(noodles) */
115 noodles = 0x1 << 0x2,
116 /* BUILD EnumItem(other) */
117 other = 012 << 777
120 /* BUILD Enum(MealType4) */
121 enum MealType4 {
122 /* BUILD EnumItem(rice) */
123 rice = true,
124 /* BUILD EnumItem(noodles) */
125 noodles = false