Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkSLLexer.h
Go to the documentation of this file.
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 <cstdint>
13#include <string_view>
14namespace SkSL {
15
16struct Token {
113
114 Token() {}
115 Token(Kind kind, int32_t offset, int32_t length)
116 : fKind(kind), fOffset(offset), fLength(length) {}
117
119 int32_t fOffset = -1;
120 int32_t fLength = -1;
121};
122
123class Lexer {
124public:
125 void start(std::string_view text) {
126 fText = text;
127 fOffset = 0;
128 }
129
130 Token next();
131
132 struct Checkpoint {
133 int32_t fOffset;
134 };
135
136 Checkpoint getCheckpoint() const { return {fOffset}; }
137
138 void rewindToCheckpoint(Checkpoint checkpoint) { fOffset = checkpoint.fOffset; }
139
140private:
141 std::string_view fText;
142 int32_t fOffset;
143};
144
145} // namespace SkSL
146#endif
Checkpoint getCheckpoint() const
Definition SkSLLexer.h:136
void rewindToCheckpoint(Checkpoint checkpoint)
Definition SkSLLexer.h:138
void start(std::string_view text)
Definition SkSLLexer.h:125
Token next()
size_t length
std::u16string text
Point offset
int32_t fOffset
Definition SkSLLexer.h:119
int32_t fLength
Definition SkSLLexer.h:120
Token(Kind kind, int32_t offset, int32_t length)
Definition SkSLLexer.h:115