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 STRUCT 91 STRUCT, 92 #undef LAYOUT 93 LAYOUT, 94 #undef PRECISION 95 PRECISION, 96 #undef ENUM 97 ENUM, 98 #undef CLASS 99 CLASS, 100 #undef IDENTIFIER 101 IDENTIFIER, 102 #undef DIRECTIVE 103 DIRECTIVE, 104 #undef SECTION 105 SECTION, 106 #undef LPAREN 107 LPAREN, 108 #undef RPAREN 109 RPAREN, 110 #undef LBRACE 111 LBRACE, 112 #undef RBRACE 113 RBRACE, 114 #undef LBRACKET 115 LBRACKET, 116 #undef RBRACKET 117 RBRACKET, 118 #undef DOT 119 DOT, 120 #undef COMMA 121 COMMA, 122 #undef PLUSPLUS 123 PLUSPLUS, 124 #undef MINUSMINUS 125 MINUSMINUS, 126 #undef PLUS 127 PLUS, 128 #undef MINUS 129 MINUS, 130 #undef STAR 131 STAR, 132 #undef SLASH 133 SLASH, 134 #undef PERCENT 135 PERCENT, 136 #undef SHL 137 SHL, 138 #undef SHR 139 SHR, 140 #undef BITWISEOR 141 BITWISEOR, 142 #undef BITWISEXOR 143 BITWISEXOR, 144 #undef BITWISEAND 145 BITWISEAND, 146 #undef BITWISENOT 147 BITWISENOT, 148 #undef LOGICALOR 149 LOGICALOR, 150 #undef LOGICALXOR 151 LOGICALXOR, 152 #undef LOGICALAND 153 LOGICALAND, 154 #undef LOGICALNOT 155 LOGICALNOT, 156 #undef QUESTION 157 QUESTION, 158 #undef COLONCOLON 159 COLONCOLON, 160 #undef COLON 161 COLON, 162 #undef EQ 163 EQ, 164 #undef EQEQ 165 EQEQ, 166 #undef NEQ 167 NEQ, 168 #undef GT 169 GT, 170 #undef LT 171 LT, 172 #undef GTEQ 173 GTEQ, 174 #undef LTEQ 175 LTEQ, 176 #undef PLUSEQ 177 PLUSEQ, 178 #undef MINUSEQ 179 MINUSEQ, 180 #undef STAREQ 181 STAREQ, 182 #undef SLASHEQ 183 SLASHEQ, 184 #undef PERCENTEQ 185 PERCENTEQ, 186 #undef SHLEQ 187 SHLEQ, 188 #undef SHREQ 189 SHREQ, 190 #undef BITWISEOREQ 191 BITWISEOREQ, 192 #undef BITWISEXOREQ 193 BITWISEXOREQ, 194 #undef BITWISEANDEQ 195 BITWISEANDEQ, 196 #undef LOGICALOREQ 197 LOGICALOREQ, 198 #undef LOGICALXOREQ 199 LOGICALXOREQ, 200 #undef LOGICALANDEQ 201 LOGICALANDEQ, 202 #undef SEMICOLON 203 SEMICOLON, 204 #undef ARROW 205 ARROW, 206 #undef WHITESPACE 207 WHITESPACE, 208 #undef LINE_COMMENT 209 LINE_COMMENT, 210 #undef BLOCK_COMMENT 211 BLOCK_COMMENT, 212 #undef INVALID 213 INVALID, 214 }; 215 216 Token() : fKind(Kind::INVALID), fOffset(-1), fLength(-1) {} 217 218 Token(Kind kind, int offset, int length) : fKind(kind), fOffset(offset), fLength(length) {} 219 220 Kind fKind; 221 int fOffset; 222 int fLength; 223 }; 224 225 class Lexer { 226 public: 227 void start(const char* text, size_t length) { 228 fText = text; 229 fLength = length; 230 fOffset = 0; 231 } 232 233 Token next(); 234 235 private: 236 const char* fText; 237 int fLength; 238 int fOffset; 239 }; 240 241 } // namespace 242 #endif 243