1 /* 2 * Copyright 2017 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 /***************************************************************************************** 8 ******************** This file was generated by sksllex. Do not edit. ******************* 9 *****************************************************************************************/ 10 #ifndef SKSL_Lexer 11 #define SKSL_Lexer 12 #include <cstddef> 13 #include <cstdint> 14 namespace SkSL { 15 16 struct Token { 17 enum Kind { 18 #undef END_OF_FILE 19 END_OF_FILE, 20 #undef FLOAT_LITERAL 21 FLOAT_LITERAL, 22 #undef INT_LITERAL 23 INT_LITERAL, 24 #undef TRUE_LITERAL 25 TRUE_LITERAL, 26 #undef FALSE_LITERAL 27 FALSE_LITERAL, 28 #undef IF 29 IF, 30 #undef STATIC_IF 31 STATIC_IF, 32 #undef ELSE 33 ELSE, 34 #undef FOR 35 FOR, 36 #undef WHILE 37 WHILE, 38 #undef DO 39 DO, 40 #undef SWITCH 41 SWITCH, 42 #undef STATIC_SWITCH 43 STATIC_SWITCH, 44 #undef CASE 45 CASE, 46 #undef DEFAULT 47 DEFAULT, 48 #undef BREAK 49 BREAK, 50 #undef CONTINUE 51 CONTINUE, 52 #undef DISCARD 53 DISCARD, 54 #undef RETURN 55 RETURN, 56 #undef IN 57 IN, 58 #undef OUT 59 OUT, 60 #undef INOUT 61 INOUT, 62 #undef UNIFORM 63 UNIFORM, 64 #undef CONST 65 CONST, 66 #undef LOWP 67 LOWP, 68 #undef MEDIUMP 69 MEDIUMP, 70 #undef HIGHP 71 HIGHP, 72 #undef FLAT 73 FLAT, 74 #undef NOPERSPECTIVE 75 NOPERSPECTIVE, 76 #undef READONLY 77 READONLY, 78 #undef WRITEONLY 79 WRITEONLY, 80 #undef COHERENT 81 COHERENT, 82 #undef VOLATILE 83 VOLATILE, 84 #undef RESTRICT 85 RESTRICT, 86 #undef BUFFER 87 BUFFER, 88 #undef HASSIDEEFFECTS 89 HASSIDEEFFECTS, 90 #undef PLS 91 PLS, 92 #undef PLSIN 93 PLSIN, 94 #undef PLSOUT 95 PLSOUT, 96 #undef STRUCT 97 STRUCT, 98 #undef LAYOUT 99 LAYOUT, 100 #undef PRECISION 101 PRECISION, 102 #undef ENUM 103 ENUM, 104 #undef CLASS 105 CLASS, 106 #undef IDENTIFIER 107 IDENTIFIER, 108 #undef DIRECTIVE 109 DIRECTIVE, 110 #undef SECTION 111 SECTION, 112 #undef LPAREN 113 LPAREN, 114 #undef RPAREN 115 RPAREN, 116 #undef LBRACE 117 LBRACE, 118 #undef RBRACE 119 RBRACE, 120 #undef LBRACKET 121 LBRACKET, 122 #undef RBRACKET 123 RBRACKET, 124 #undef DOT 125 DOT, 126 #undef COMMA 127 COMMA, 128 #undef PLUSPLUS 129 PLUSPLUS, 130 #undef MINUSMINUS 131 MINUSMINUS, 132 #undef PLUS 133 PLUS, 134 #undef MINUS 135 MINUS, 136 #undef STAR 137 STAR, 138 #undef SLASH 139 SLASH, 140 #undef PERCENT 141 PERCENT, 142 #undef SHL 143 SHL, 144 #undef SHR 145 SHR, 146 #undef BITWISEOR 147 BITWISEOR, 148 #undef BITWISEXOR 149 BITWISEXOR, 150 #undef BITWISEAND 151 BITWISEAND, 152 #undef BITWISENOT 153 BITWISENOT, 154 #undef LOGICALOR 155 LOGICALOR, 156 #undef LOGICALXOR 157 LOGICALXOR, 158 #undef LOGICALAND 159 LOGICALAND, 160 #undef LOGICALNOT 161 LOGICALNOT, 162 #undef QUESTION 163 QUESTION, 164 #undef COLONCOLON 165 COLONCOLON, 166 #undef COLON 167 COLON, 168 #undef EQ 169 EQ, 170 #undef EQEQ 171 EQEQ, 172 #undef NEQ 173 NEQ, 174 #undef GT 175 GT, 176 #undef LT 177 LT, 178 #undef GTEQ 179 GTEQ, 180 #undef LTEQ 181 LTEQ, 182 #undef PLUSEQ 183 PLUSEQ, 184 #undef MINUSEQ 185 MINUSEQ, 186 #undef STAREQ 187 STAREQ, 188 #undef SLASHEQ 189 SLASHEQ, 190 #undef PERCENTEQ 191 PERCENTEQ, 192 #undef SHLEQ 193 SHLEQ, 194 #undef SHREQ 195 SHREQ, 196 #undef BITWISEOREQ 197 BITWISEOREQ, 198 #undef BITWISEXOREQ 199 BITWISEXOREQ, 200 #undef BITWISEANDEQ 201 BITWISEANDEQ, 202 #undef LOGICALOREQ 203 LOGICALOREQ, 204 #undef LOGICALXOREQ 205 LOGICALXOREQ, 206 #undef LOGICALANDEQ 207 LOGICALANDEQ, 208 #undef SEMICOLON 209 SEMICOLON, 210 #undef ARROW 211 ARROW, 212 #undef WHITESPACE 213 WHITESPACE, 214 #undef LINE_COMMENT 215 LINE_COMMENT, 216 #undef BLOCK_COMMENT 217 BLOCK_COMMENT, 218 #undef INVALID 219 INVALID, 220 }; 221 TokenToken222 Token() : fKind(Kind::INVALID), fOffset(-1), fLength(-1) {} 223 TokenToken224 Token(Kind kind, int32_t offset, int32_t length) 225 : fKind(kind), fOffset(offset), fLength(length) {} 226 227 Kind fKind; 228 int fOffset; 229 int fLength; 230 }; 231 232 class Lexer { 233 public: start(const char * text,int32_t length)234 void start(const char* text, int32_t length) { 235 fText = text; 236 fLength = length; 237 fOffset = 0; 238 } 239 240 Token next(); 241 242 private: 243 const char* fText; 244 int32_t fLength; 245 int32_t fOffset; 246 }; 247 248 } // namespace 249 #endif 250