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 Enum productions 6 7 Run with --test to generate an AST and verify that all comments accurately 8 reflect the state of the Nodes. 9 10 BUILD Type(Name) 11 This comment signals that a node of type <Type> is created with the 12 name <Name>. 13 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. 17 18 PROP Key=Value 19 This comment signals that a property has been set on the Node such that 20 <Key> = <Value>. 21 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. 30 */ 31 32 /* TREE 33 *Enum(MealType1) 34 * EnumItem(rice) 35 * EnumItem(noodles) 36 * EnumItem(other) 37 */ 38 enum MealType1 { 39 /* BUILD EnumItem (rice) */ 40 "rice", 41 /* BUILD EnumItem (noodles) */ 42 "noodles", 43 /* BUILD EnumItem(other) */ 44 "other" 45 }; 46 47 /* BUILD Error(Enum missing name.) */ 48 /* ERROR Enum missing name. */ 49 enum { 50 "rice", 51 "noodles", 52 "other" 53 }; 54 55 /* TREE 56 *Enum(MealType2) 57 * EnumItem(rice) 58 * EnumItem(noodles) 59 * EnumItem(other) 60 */ 61 enum MealType2 { 62 /* BUILD EnumItem(rice) */ 63 "rice", 64 /* BUILD EnumItem(noodles) */ 65 "noodles", 66 /* BUILD EnumItem(other) */ 67 "other" 68 }; 69 70 /* BUILD Error(Unexpected string "noodles" after string "rice".) */ 71 /* ERROR Unexpected string "noodles" after string "rice". */ 72 enum MissingComma { 73 "rice" 74 "noodles", 75 "other" 76 }; 77 78 /* BUILD Error(Trailing comma in block.) */ 79 /* ERROR Trailing comma in block. */ 80 enum TrailingComma { 81 "rice", 82 "noodles", 83 "other", 84 }; 85 86 /* BUILD Error(Unexpected "," after ",".) */ 87 /* ERROR Unexpected "," after ",". */ 88 enum ExtraComma { 89 "rice", 90 "noodles", 91 ,"other", 92 }; 93 94 /* BUILD Error(Unexpected keyword "interface" after "{".) */ 95 /* ERROR Unexpected keyword "interface" after "{". */ 96 enum ExtraComma { 97 interface, 98 "noodles", 99 ,"other", 100 }; 101 102 /* BUILD Error(Unexpected identifier "somename" after "{".) */ 103 /* ERROR Unexpected identifier "somename" after "{". */ 104 enum ExtraComma { 105 somename, 106 "noodles", 107 ,"other", 108 }; 109 110 /* BUILD Enum(MealType3) */ 111 enum MealType3 { 112 /* BUILD EnumItem(rice) */ 113 "rice", 114 /* BUILD EnumItem(noodles) */ 115 "noodles", 116 /* BUILD EnumItem(other) */ 117 "other" 118 }; 119 120