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>
14namespace SkSL {
15
16struct 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 NULL_LITERAL
57 NULL_LITERAL,
58#undef IN
59 IN,
60#undef OUT
61 OUT,
62#undef INOUT
63 INOUT,
64#undef UNIFORM
65 UNIFORM,
66#undef CONST
67 CONST,
68#undef FLAT
69 FLAT,
70#undef NOPERSPECTIVE
71 NOPERSPECTIVE,
72#undef READONLY
73 READONLY,
74#undef WRITEONLY
75 WRITEONLY,
76#undef COHERENT
77 COHERENT,
78#undef VOLATILE
79 VOLATILE,
80#undef RESTRICT
81 RESTRICT,
82#undef BUFFER
83 BUFFER,
84#undef HASSIDEEFFECTS
85 HASSIDEEFFECTS,
86#undef PLS
87 PLS,
88#undef PLSIN
89 PLSIN,
90#undef PLSOUT
91 PLSOUT,
92#undef VARYING
93 VARYING,
94#undef STRUCT
95 STRUCT,
96#undef LAYOUT
97 LAYOUT,
98#undef PRECISION
99 PRECISION,
100#undef ENUM
101 ENUM,
102#undef CLASS
103 CLASS,
104#undef IDENTIFIER
105 IDENTIFIER,
106#undef DIRECTIVE
107 DIRECTIVE,
108#undef SECTION
109 SECTION,
110#undef LPAREN
111 LPAREN,
112#undef RPAREN
113 RPAREN,
114#undef LBRACE
115 LBRACE,
116#undef RBRACE
117 RBRACE,
118#undef LBRACKET
119 LBRACKET,
120#undef RBRACKET
121 RBRACKET,
122#undef DOT
123 DOT,
124#undef COMMA
125 COMMA,
126#undef PLUSPLUS
127 PLUSPLUS,
128#undef MINUSMINUS
129 MINUSMINUS,
130#undef PLUS
131 PLUS,
132#undef MINUS
133 MINUS,
134#undef STAR
135 STAR,
136#undef SLASH
137 SLASH,
138#undef PERCENT
139 PERCENT,
140#undef SHL
141 SHL,
142#undef SHR
143 SHR,
144#undef BITWISEOR
145 BITWISEOR,
146#undef BITWISEXOR
147 BITWISEXOR,
148#undef BITWISEAND
149 BITWISEAND,
150#undef BITWISENOT
151 BITWISENOT,
152#undef LOGICALOR
153 LOGICALOR,
154#undef LOGICALXOR
155 LOGICALXOR,
156#undef LOGICALAND
157 LOGICALAND,
158#undef LOGICALNOT
159 LOGICALNOT,
160#undef QUESTION
161 QUESTION,
162#undef COLONCOLON
163 COLONCOLON,
164#undef COLON
165 COLON,
166#undef EQ
167 EQ,
168#undef EQEQ
169 EQEQ,
170#undef NEQ
171 NEQ,
172#undef GT
173 GT,
174#undef LT
175 LT,
176#undef GTEQ
177 GTEQ,
178#undef LTEQ
179 LTEQ,
180#undef PLUSEQ
181 PLUSEQ,
182#undef MINUSEQ
183 MINUSEQ,
184#undef STAREQ
185 STAREQ,
186#undef SLASHEQ
187 SLASHEQ,
188#undef PERCENTEQ
189 PERCENTEQ,
190#undef SHLEQ
191 SHLEQ,
192#undef SHREQ
193 SHREQ,
194#undef BITWISEOREQ
195 BITWISEOREQ,
196#undef BITWISEXOREQ
197 BITWISEXOREQ,
198#undef BITWISEANDEQ
199 BITWISEANDEQ,
200#undef LOGICALOREQ
201 LOGICALOREQ,
202#undef LOGICALXOREQ
203 LOGICALXOREQ,
204#undef LOGICALANDEQ
205 LOGICALANDEQ,
206#undef SEMICOLON
207 SEMICOLON,
208#undef ARROW
209 ARROW,
210#undef WHITESPACE
211 WHITESPACE,
212#undef LINE_COMMENT
213 LINE_COMMENT,
214#undef BLOCK_COMMENT
215 BLOCK_COMMENT,
216#undef INVALID
217 INVALID,
218 };
219
220 Token() : fKind(Kind::INVALID), fOffset(-1), fLength(-1) {}
221
222 Token(Kind kind, int32_t offset, int32_t length)
223 : fKind(kind), fOffset(offset), fLength(length) {}
224
225 Kind fKind;
226 int fOffset;
227 int fLength;
228};
229
230class Lexer {
231public:
232 void start(const char* text, int32_t length) {
233 fText = text;
234 fLength = length;
235 fOffset = 0;
236 }
237
238 Token next();
239
240private:
241 const char* fText;
242 int32_t fLength;
243 int32_t fOffset;
244};
245
246} // namespace SkSL
247#endif
248