Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 Use of this source code is governed by a BSD-style license that can be |
| 3 found in the LICENSE file. */ | 3 found in the LICENSE file. */ |
| 4 | 4 |
| 5 /* Test Enum productions | 5 /* Test Enum productions |
| 6 | 6 |
| 7 Run with --test to generate an AST and verify that all comments accurately | 7 Run with --test to generate an AST and verify that all comments accurately |
| 8 reflect the state of the Nodes. | 8 reflect the state of the Nodes. |
| 9 | 9 |
| 10 BUILD Type(Name) | 10 BUILD Type(Name) |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 */ | 30 */ |
| 31 | 31 |
| 32 /* TREE | 32 /* TREE |
| 33 *Enum(MealType1) | 33 *Enum(MealType1) |
| 34 * EnumItem(rice) | 34 * EnumItem(rice) |
| 35 * EnumItem(noodles) | 35 * EnumItem(noodles) |
| 36 * EnumItem(other) | 36 * EnumItem(other) |
| 37 */ | 37 */ |
| 38 enum MealType1 { | 38 enum MealType1 { |
| 39 /* BUILD EnumItem (rice) */ | 39 /* BUILD EnumItem (rice) */ |
| 40 "rice", | 40 rice, |
| 41 /* BUILD EnumItem (noodles) */ | 41 /* BUILD EnumItem (noodles) */ |
| 42 "noodles", | 42 noodles, |
| 43 /* BUILD EnumItem(other) */ | 43 /* BUILD EnumItem(other) */ |
| 44 "other" | 44 other |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 /* BUILD Error(Enum missing name.) */ | 47 /* BUILD Error(Enum missing name.) */ |
| 48 /* ERROR Enum missing name. */ | 48 /* ERROR Enum missing name. */ |
| 49 enum { | 49 enum { |
| 50 "rice", | 50 rice, |
| 51 "noodles", | 51 noodles, |
| 52 "other" | 52 other, |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 /* TREE | 55 /* TREE |
| 56 *Enum(MealType2) | 56 *Enum(MealType2) |
| 57 * EnumItem(rice) | 57 * EnumItem(rice) |
| 58 * EnumItem(noodles) | 58 * EnumItem(noodles) |
| 59 * EnumItem(other) | 59 * EnumItem(other) |
| 60 */ | 60 */ |
| 61 enum MealType2 { | 61 enum MealType2 { |
| 62 /* BUILD EnumItem(rice) */ | 62 /* BUILD EnumItem(rice) */ |
| 63 "rice", | 63 rice, |
| 64 /* BUILD EnumItem(noodles) */ | 64 /* BUILD EnumItem(noodles) */ |
| 65 "noodles", | 65 noodles = 1, |
| 66 /* BUILD EnumItem(other) */ | 66 /* BUILD EnumItem(other) */ |
| 67 "other" | 67 other |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 /* BUILD Error(Unexpected string "noodles" after string "rice".) */ | 70 /* BUILD Error(Unexpected identifier "noodles" after identifier "rice".) */ |
| 71 /* ERROR Unexpected string "noodles" after string "rice". */ | 71 /* ERROR Unexpected identifier "noodles" after identifier "rice". */ |
| 72 enum MissingComma { | 72 enum MissingComma { |
| 73 "rice" | 73 rice |
| 74 "noodles", | 74 noodles, |
| 75 "other" | 75 other |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 /* BUILD Error(Trailing comma in block.) */ | 78 /* BUILD Error(Trailing comma in block.) */ |
| 79 /* ERROR Trailing comma in block. */ | 79 /* ERROR Trailing comma in block. */ |
| 80 enum TrailingComma { | 80 enum TrailingComma { |
| 81 "rice", | 81 rice, |
| 82 "noodles", | 82 noodles, |
| 83 "other", | 83 other, |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 /* BUILD Error(Unexpected "," after ",".) */ | 86 /* BUILD Error(Unexpected "," after ",".) */ |
| 87 /* ERROR Unexpected "," after ",". */ | 87 /* ERROR Unexpected "," after ",". */ |
| 88 enum ExtraComma { | 88 enum ExtraComma { |
| 89 "rice", | 89 rice, |
| 90 "noodles", | 90 noodles, |
| 91 ,"other", | 91 ,other, |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 /* BUILD Error(Unexpected keyword "interface" after "{".) */ | 94 /* BUILD Error(Unexpected keyword "interface" after "{".) */ |
| 95 /* ERROR Unexpected keyword "interface" after "{". */ | 95 /* ERROR Unexpected keyword "interface" after "{". */ |
| 96 enum ExtraComma { | 96 enum ExtraComma { |
| 97 interface, | 97 interface, |
| 98 "noodles", | 98 noodles, |
| 99 ,"other", | 99 ,other, |
| 100 }; | 100 }; |
| 101 | 101 |
| 102 /* BUILD Error(Unexpected identifier "somename" after "{".) */ | 102 /* BUILD Error(Unexpected string "somename" after "{".) */ |
| 103 /* ERROR Unexpected identifier "somename" after "{". */ | 103 /* ERROR Unexpected string "somename" after "{". */ |
| 104 enum ExtraComma { | 104 enum ExtraComma { |
| 105 somename, | 105 "somename", |
| 106 "noodles", | 106 noodles, |
| 107 ,"other", | 107 other, |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 /* BUILD Enum(MealType3) */ | 110 /* BUILD Enum(MealType3) */ |
| 111 enum MealType3 { | 111 enum MealType3 { |
| 112 /* BUILD EnumItem(rice) */ | 112 /* BUILD EnumItem(rice) */ |
| 113 "rice", | 113 rice = 1 << 1, |
| 114 /* BUILD EnumItem(noodles) */ | 114 /* BUILD EnumItem(noodles) */ |
| 115 "noodles", | 115 noodles = 0x1 << 0x2, |
|
nfullagar1
2013/07/01 17:22:13
what is expected outcome for octal?
noelallen1
2013/07/01 17:46:06
Octal should be legal, although we never use it.
| |
| 116 /* BUILD EnumItem(other) */ | 116 /* BUILD EnumItem(other) */ |
| 117 "other" | 117 other = 0 |
| 118 }; | 118 }; |
| 119 | 119 |
| OLD | NEW |