re-land of new SkSL precisions
Bug: skia:
Change-Id: Ic1deb3db2cbda6ca45f93dee99832971a36a2119
Reviewed-on: https://skia-review.googlesource.com/47841
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
diff --git a/src/sksl/SkSLParser.cpp b/src/sksl/SkSLParser.cpp
index d8ecc61..9bfa62f 100644
--- a/src/sksl/SkSLParser.cpp
+++ b/src/sksl/SkSLParser.cpp
@@ -29,7 +29,6 @@
#include "ast/SkSLASTIntLiteral.h"
#include "ast/SkSLASTModifiersDeclaration.h"
#include "ast/SkSLASTParameter.h"
-#include "ast/SkSLASTPrecision.h"
#include "ast/SkSLASTPrefixExpression.h"
#include "ast/SkSLASTReturnStatement.h"
#include "ast/SkSLASTSection.h"
@@ -81,20 +80,13 @@
fLexer.start(text, length);
}
-/* (precision | directive | section | declaration)* END_OF_FILE */
+/* (directive | section | declaration)* END_OF_FILE */
std::vector<std::unique_ptr<ASTDeclaration>> Parser::file() {
std::vector<std::unique_ptr<ASTDeclaration>> result;
for (;;) {
switch (this->peek().fKind) {
case Token::END_OF_FILE:
return result;
- case Token::PRECISION: {
- std::unique_ptr<ASTDeclaration> precision = this->precision();
- if (precision) {
- result.push_back(std::move(precision));
- }
- break;
- }
case Token::DIRECTIVE: {
std::unique_ptr<ASTDeclaration> decl = this->directive();
if (decl) {
@@ -196,36 +188,6 @@
return nullptr != fTypes[name];
}
-/* PRECISION (LOWP | MEDIUMP | HIGHP) type SEMICOLON */
-std::unique_ptr<ASTDeclaration> Parser::precision() {
- if (!this->expect(Token::PRECISION, "'precision'")) {
- return nullptr;
- }
- Modifiers::Flag result;
- Token p = this->nextToken();
- switch (p.fKind) {
- case Token::LOWP:
- result = Modifiers::kLowp_Flag;
- break;
- case Token::MEDIUMP:
- result = Modifiers::kMediump_Flag;
- break;
- case Token::HIGHP:
- result = Modifiers::kHighp_Flag;
- break;
- default:
- this->error(p, "expected 'lowp', 'mediump', or 'highp', but found '" +
- this->text(p) + "'");
- return nullptr;
- }
- // FIXME handle the type
- if (!this->type()) {
- return nullptr;
- }
- this->expect(Token::SEMICOLON, "';'");
- return std::unique_ptr<ASTDeclaration>(new ASTPrecision(p.fOffset, result));
-}
-
/* DIRECTIVE(#version) INT_LITERAL ("es" | "compatibility")? |
DIRECTIVE(#extension) IDENTIFIER COLON IDENTIFIER */
std::unique_ptr<ASTDeclaration> Parser::directive() {