| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "stdio.h" | 8 #include "stdio.h" |
| 9 #include "SkSLParser.h" | 9 #include "SkSLParser.h" |
| 10 #include "SkSLToken.h" | 10 #include "SkSLToken.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 skslset_lineno(1, fScanner); | 63 skslset_lineno(1, fScanner); |
| 64 | 64 |
| 65 if (false) { | 65 if (false) { |
| 66 // avoid unused warning | 66 // avoid unused warning |
| 67 yyunput(0, nullptr, fScanner); | 67 yyunput(0, nullptr, fScanner); |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | 70 |
| 71 Parser::~Parser() { | 71 Parser::~Parser() { |
| 72 sksl_delete_buffer(fBuffer, fScanner); | 72 sksl_delete_buffer(fBuffer, fScanner); |
| 73 sksllex_destroy(fScanner); |
| 73 } | 74 } |
| 74 | 75 |
| 75 /* (precision | directive | declaration)* END_OF_FILE */ | 76 /* (precision | directive | declaration)* END_OF_FILE */ |
| 76 std::vector<std::unique_ptr<ASTDeclaration>> Parser::file() { | 77 std::vector<std::unique_ptr<ASTDeclaration>> Parser::file() { |
| 77 std::vector<std::unique_ptr<ASTDeclaration>> result; | 78 std::vector<std::unique_ptr<ASTDeclaration>> result; |
| 78 for (;;) { | 79 for (;;) { |
| 79 switch (this->peek().fKind) { | 80 switch (this->peek().fKind) { |
| 80 case Token::END_OF_FILE: | 81 case Token::END_OF_FILE: |
| 81 return result; | 82 return result; |
| 82 case Token::PRECISION: | 83 case Token::PRECISION: |
| (...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1380 bool Parser::identifier(std::string* dest) { | 1381 bool Parser::identifier(std::string* dest) { |
| 1381 Token t; | 1382 Token t; |
| 1382 if (this->expect(Token::IDENTIFIER, "identifier", &t)) { | 1383 if (this->expect(Token::IDENTIFIER, "identifier", &t)) { |
| 1383 *dest = t.fText; | 1384 *dest = t.fText; |
| 1384 return true; | 1385 return true; |
| 1385 } | 1386 } |
| 1386 return false; | 1387 return false; |
| 1387 } | 1388 } |
| 1388 | 1389 |
| 1389 } // namespace | 1390 } // namespace |
| OLD | NEW |