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 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 PLUS, | 42 PLUS, |
43 MINUS, | 43 MINUS, |
44 STAR, | 44 STAR, |
45 SLASH, | 45 SLASH, |
46 PERCENT, | 46 PERCENT, |
47 SHL, | 47 SHL, |
48 SHR, | 48 SHR, |
49 BITWISEOR, | 49 BITWISEOR, |
50 BITWISEXOR, | 50 BITWISEXOR, |
51 BITWISEAND, | 51 BITWISEAND, |
| 52 BITWISENOT, |
52 LOGICALOR, | 53 LOGICALOR, |
53 LOGICALXOR, | 54 LOGICALXOR, |
54 LOGICALAND, | 55 LOGICALAND, |
55 NOT, | 56 LOGICALNOT, |
56 QUESTION, | 57 QUESTION, |
57 COLON, | 58 COLON, |
58 EQ, | 59 EQ, |
59 EQEQ, | 60 EQEQ, |
60 NEQ, | 61 NEQ, |
61 GT, | 62 GT, |
62 LT, | 63 LT, |
63 GTEQ, | 64 GTEQ, |
64 LTEQ, | 65 LTEQ, |
65 PLUSEQ, | 66 PLUSEQ, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 105 |
105 static std::string OperatorName(Kind kind) { | 106 static std::string OperatorName(Kind kind) { |
106 switch (kind) { | 107 switch (kind) { |
107 case Token::PLUS: return "+"; | 108 case Token::PLUS: return "+"; |
108 case Token::MINUS: return "-"; | 109 case Token::MINUS: return "-"; |
109 case Token::STAR: return "*"; | 110 case Token::STAR: return "*"; |
110 case Token::SLASH: return "/"; | 111 case Token::SLASH: return "/"; |
111 case Token::PERCENT: return "%"; | 112 case Token::PERCENT: return "%"; |
112 case Token::SHL: return "<<"; | 113 case Token::SHL: return "<<"; |
113 case Token::SHR: return ">>"; | 114 case Token::SHR: return ">>"; |
| 115 case Token::LOGICALNOT: return "!"; |
114 case Token::LOGICALAND: return "&&"; | 116 case Token::LOGICALAND: return "&&"; |
115 case Token::LOGICALOR: return "||"; | 117 case Token::LOGICALOR: return "||"; |
116 case Token::LOGICALXOR: return "^^"; | 118 case Token::LOGICALXOR: return "^^"; |
| 119 case Token::BITWISENOT: return "~"; |
117 case Token::BITWISEAND: return "&"; | 120 case Token::BITWISEAND: return "&"; |
118 case Token::BITWISEOR: return "|"; | 121 case Token::BITWISEOR: return "|"; |
119 case Token::BITWISEXOR: return "^"; | 122 case Token::BITWISEXOR: return "^"; |
120 case Token::EQ: return "="; | 123 case Token::EQ: return "="; |
121 case Token::EQEQ: return "=="; | 124 case Token::EQEQ: return "=="; |
122 case Token::NEQ: return "!="; | 125 case Token::NEQ: return "!="; |
123 case Token::LT: return "<"; | 126 case Token::LT: return "<"; |
124 case Token::GT: return ">"; | 127 case Token::GT: return ">"; |
125 case Token::LTEQ: return "<="; | 128 case Token::LTEQ: return "<="; |
126 case Token::GTEQ: return ">="; | 129 case Token::GTEQ: return ">="; |
127 case Token::PLUSEQ: return "+="; | 130 case Token::PLUSEQ: return "+="; |
128 case Token::MINUSEQ: return "-="; | 131 case Token::MINUSEQ: return "-="; |
129 case Token::STAREQ: return "*="; | 132 case Token::STAREQ: return "*="; |
130 case Token::SLASHEQ: return "/="; | 133 case Token::SLASHEQ: return "/="; |
131 case Token::PERCENTEQ: return "%="; | 134 case Token::PERCENTEQ: return "%="; |
132 case Token::SHLEQ: return "<<="; | 135 case Token::SHLEQ: return "<<="; |
133 case Token::SHREQ: return ">>="; | 136 case Token::SHREQ: return ">>="; |
134 case Token::LOGICALANDEQ: return "&&="; | 137 case Token::LOGICALANDEQ: return "&&="; |
135 case Token::LOGICALOREQ: return "||="; | 138 case Token::LOGICALOREQ: return "||="; |
136 case Token::LOGICALXOREQ: return "^^="; | 139 case Token::LOGICALXOREQ: return "^^="; |
137 case Token::BITWISEANDEQ: return "&="; | 140 case Token::BITWISEANDEQ: return "&="; |
138 case Token::BITWISEOREQ: return "|="; | 141 case Token::BITWISEOREQ: return "|="; |
139 case Token::BITWISEXOREQ: return "^="; | 142 case Token::BITWISEXOREQ: return "^="; |
140 case Token::PLUSPLUS: return "++"; | 143 case Token::PLUSPLUS: return "++"; |
141 case Token::MINUSMINUS: return "--"; | 144 case Token::MINUSMINUS: return "--"; |
142 case Token::NOT: return "!"; | |
143 default: | 145 default: |
144 ABORT("unsupported operator: %d\n", kind); | 146 ABORT("unsupported operator: %d\n", kind); |
145 } | 147 } |
146 } | 148 } |
147 | 149 |
148 Token() { | 150 Token() { |
149 } | 151 } |
150 | 152 |
151 Token(Position position, Kind kind, std::string text) | 153 Token(Position position, Kind kind, std::string text) |
152 : fPosition(position) | 154 : fPosition(position) |
153 , fKind(kind) | 155 , fKind(kind) |
154 , fText(std::move(text)) {} | 156 , fText(std::move(text)) {} |
155 | 157 |
156 Position fPosition; | 158 Position fPosition; |
157 Kind fKind; | 159 Kind fKind; |
158 std::string fText; | 160 std::string fText; |
159 }; | 161 }; |
160 | 162 |
161 } // namespace | 163 } // namespace |
162 #endif | 164 #endif |
OLD | NEW |