diff options
author | Ethan Nicholas <ethannicholas@google.com> | 2017-09-07 15:44:01 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-09-11 16:17:00 +0000 |
commit | c576e93d174f3106e072a2f506bca3990b541265 (patch) | |
tree | d4a410200aa71183c95643535b440bec919f2e18 /src/sksl/ir/SkSLProgram.h | |
parent | a2bdf005f3c706065d1aa93f319f4b73932721d4 (diff) |
Switch to the new SkSL lexer.
This completely replaces flex with a new in-house lexical analyzer generator,
which we have done for performance and memory usage reasons. Flex requires us
to copy strings every time we need the text of a token, whereas this new lexer
allows us to handle strings as a (non-null-terminated) pointer and length
everywhere, eliminating most string copies.
Bug: skia:
Change-Id: I2add26efc9e20cb699520e82abcf713af3968aca
Reviewed-on: https://skia-review.googlesource.com/39780
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'src/sksl/ir/SkSLProgram.h')
-rw-r--r-- | src/sksl/ir/SkSLProgram.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/sksl/ir/SkSLProgram.h b/src/sksl/ir/SkSLProgram.h index a3eeaa3612..639e09b16a 100644 --- a/src/sksl/ir/SkSLProgram.h +++ b/src/sksl/ir/SkSLProgram.h @@ -39,15 +39,15 @@ struct Program { : fKind(kInt_Kind) , fValue(i) {} - std::unique_ptr<Expression> literal(const Context& context, Position position) const { + std::unique_ptr<Expression> literal(const Context& context, int offset) const { switch (fKind) { case Program::Settings::Value::kBool_Kind: return std::unique_ptr<Expression>(new BoolLiteral(context, - position, + offset, fValue)); case Program::Settings::Value::kInt_Kind: return std::unique_ptr<Expression>(new IntLiteral(context, - position, + offset, fValue)); default: ASSERT(false); @@ -103,6 +103,7 @@ struct Program { }; Program(Kind kind, + std::unique_ptr<String> source, Settings settings, Modifiers::Flag defaultPrecision, Context* context, @@ -110,6 +111,7 @@ struct Program { std::shared_ptr<SymbolTable> symbols, Inputs inputs) : fKind(kind) + , fSource(std::move(source)) , fSettings(settings) , fDefaultPrecision(defaultPrecision) , fContext(context) @@ -118,6 +120,7 @@ struct Program { , fInputs(inputs) {} Kind fKind; + std::unique_ptr<String> fSource; Settings fSettings; // FIXME handle different types; currently it assumes this is for floats Modifiers::Flag fDefaultPrecision; |