| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SKSL_TOKEN | 8 #ifndef SKSL_TOKEN |
| 9 #define SKSL_TOKEN | 9 #define SKSL_TOKEN |
| 10 | 10 |
| 11 #include "SkSLPosition.h" | 11 #include "SkSLPosition.h" |
| 12 #include "SkSLUtil.h" | 12 #include "SkSLUtil.h" |
| 13 | 13 |
| 14 namespace SkSL { | 14 namespace SkSL { |
| 15 | 15 |
| 16 #undef IN |
| 17 #undef OUT |
| 18 #undef CONST |
| 19 |
| 16 /** | 20 /** |
| 17 * Represents a lexical analysis token. Token is generally only used during the
parse process, but | 21 * Represents a lexical analysis token. Token is generally only used during the
parse process, but |
| 18 * Token::Kind is also used to represent operator kinds. | 22 * Token::Kind is also used to represent operator kinds. |
| 19 */ | 23 */ |
| 20 struct Token { | 24 struct Token { |
| 21 enum Kind { | 25 enum Kind { |
| 22 END_OF_FILE, | 26 END_OF_FILE, |
| 23 IDENTIFIER, | 27 IDENTIFIER, |
| 24 INT_LITERAL, | 28 INT_LITERAL, |
| 25 FLOAT_LITERAL, | 29 FLOAT_LITERAL, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 CONTINUE, | 86 CONTINUE, |
| 83 DISCARD, | 87 DISCARD, |
| 84 IN, | 88 IN, |
| 85 OUT, | 89 OUT, |
| 86 INOUT, | 90 INOUT, |
| 87 CONST, | 91 CONST, |
| 88 LOWP, | 92 LOWP, |
| 89 MEDIUMP, | 93 MEDIUMP, |
| 90 HIGHP, | 94 HIGHP, |
| 91 UNIFORM, | 95 UNIFORM, |
| 96 FLAT, |
| 97 NOPERSPECTIVE, |
| 92 STRUCT, | 98 STRUCT, |
| 93 LAYOUT, | 99 LAYOUT, |
| 94 DIRECTIVE, | 100 DIRECTIVE, |
| 95 PRECISION, | 101 PRECISION, |
| 96 INVALID_TOKEN | 102 INVALID_TOKEN |
| 97 }; | 103 }; |
| 98 | 104 |
| 99 static std::string OperatorName(Kind kind) { | 105 static std::string OperatorName(Kind kind) { |
| 100 switch (kind) { | 106 switch (kind) { |
| 101 case Token::PLUS: return "+"; | 107 case Token::PLUS: return "+"; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 , fKind(kind) | 153 , fKind(kind) |
| 148 , fText(std::move(text)) {} | 154 , fText(std::move(text)) {} |
| 149 | 155 |
| 150 Position fPosition; | 156 Position fPosition; |
| 151 Kind fKind; | 157 Kind fKind; |
| 152 std::string fText; | 158 std::string fText; |
| 153 }; | 159 }; |
| 154 | 160 |
| 155 } // namespace | 161 } // namespace |
| 156 #endif | 162 #endif |
| OLD | NEW |