skia2/src/sksl/SkSLLexer.h

140 lines
2.9 KiB
C
Raw Normal View History

/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/*****************************************************************************************
******************** This file was generated by sksllex. Do not edit. *******************
*****************************************************************************************/
#ifndef SKSL_Lexer
#define SKSL_Lexer
#include <cstddef>
#include <cstdint>
namespace SkSL {
struct Token {
enum class Kind {
TK_END_OF_FILE,
TK_FLOAT_LITERAL,
TK_INT_LITERAL,
TK_TRUE_LITERAL,
TK_FALSE_LITERAL,
TK_IF,
TK_STATIC_IF,
TK_ELSE,
TK_FOR,
TK_WHILE,
TK_DO,
TK_SWITCH,
TK_STATIC_SWITCH,
TK_CASE,
TK_DEFAULT,
TK_BREAK,
TK_CONTINUE,
TK_DISCARD,
TK_RETURN,
TK_IN,
TK_OUT,
TK_INOUT,
TK_UNIFORM,
TK_CONST,
TK_FLAT,
TK_NOPERSPECTIVE,
Reland "Added support for the 'inline' hint on SkSL functions" This reverts commit 1394f71ff0e55d890e7a9418aab2a12508499948. Reason for revert: doesn't seem to have been the culprit Original change's description: > Revert "Added support for the 'inline' hint on SkSL functions" > > This reverts commit 338e57d4b1f5de06a43b69d70d4eff6951652d06. > > Reason for revert: maybe breaking Chrome roll > > Original change's description: > > Added support for the 'inline' hint on SkSL functions > > > > Change-Id: Ib78e0ad9fd1cc15e7afeb2a9ddd6b1249828fbe7 > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/311603 > > Commit-Queue: Ethan Nicholas <ethannicholas@google.com> > > Reviewed-by: John Stiles <johnstiles@google.com> > > TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com > > Change-Id: Ifd199db94a78e4cb389576b9ff282f54a582c421 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/312078 > Reviewed-by: Ethan Nicholas <ethannicholas@google.com> > Commit-Queue: Ethan Nicholas <ethannicholas@google.com> TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com # Not skipping CQ checks because this is a reland. Change-Id: I241f6bf16602bb5e011a2a5879a2df515fa0953b Reviewed-on: https://skia-review.googlesource.com/c/skia/+/312097 Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2020-08-20 13:09:14 +00:00
TK_INLINE,
TK_HASSIDEEFFECTS,
TK_VARYING,
TK_STRUCT,
TK_LAYOUT,
TK_ENUM,
TK_CLASS,
TK_IDENTIFIER,
TK_DIRECTIVE,
TK_SECTION,
TK_LPAREN,
TK_RPAREN,
TK_LBRACE,
TK_RBRACE,
TK_LBRACKET,
TK_RBRACKET,
TK_DOT,
TK_COMMA,
TK_PLUSPLUS,
TK_MINUSMINUS,
TK_PLUS,
TK_MINUS,
TK_STAR,
TK_SLASH,
TK_PERCENT,
TK_SHL,
TK_SHR,
TK_BITWISEOR,
TK_BITWISEXOR,
TK_BITWISEAND,
TK_BITWISENOT,
TK_LOGICALOR,
TK_LOGICALXOR,
TK_LOGICALAND,
TK_LOGICALNOT,
TK_QUESTION,
TK_COLONCOLON,
TK_COLON,
TK_EQ,
TK_EQEQ,
TK_NEQ,
TK_GT,
TK_LT,
TK_GTEQ,
TK_LTEQ,
TK_PLUSEQ,
TK_MINUSEQ,
TK_STAREQ,
TK_SLASHEQ,
TK_PERCENTEQ,
TK_SHLEQ,
TK_SHREQ,
TK_BITWISEOREQ,
TK_BITWISEXOREQ,
TK_BITWISEANDEQ,
TK_SEMICOLON,
TK_ARROW,
TK_WHITESPACE,
TK_LINE_COMMENT,
TK_BLOCK_COMMENT,
TK_INVALID,
TK_NONE,
};
Token() : fKind(Kind::TK_NONE), fOffset(-1), fLength(-1) {}
Token(Kind kind, int32_t offset, int32_t length)
: fKind(kind), fOffset(offset), fLength(length) {}
Kind fKind;
int fOffset;
int fLength;
};
class Lexer {
public:
void start(const char* text, int32_t length) {
fText = text;
fLength = length;
fOffset = 0;
}
Token next();
int32_t getCheckpoint() const { return fOffset; }
void rewindToCheckpoint(int32_t checkpoint) { fOffset = checkpoint; }
private:
const char* fText;
int32_t fLength;
int32_t fOffset;
};
} // namespace SkSL
#endif