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