| 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 #ifndef SKSL_COMPILER | 8 #ifndef SKSL_COMPILER |
| 9 #define SKSL_COMPILER | 9 #define SKSL_COMPILER |
| 10 | 10 |
| 11 #include <vector> | 11 #include <vector> |
| 12 #include "ir/SkSLProgram.h" | 12 #include "ir/SkSLProgram.h" |
| 13 #include "ir/SkSLSymbolTable.h" | 13 #include "ir/SkSLSymbolTable.h" |
| 14 #include "SkSLContext.h" |
| 14 #include "SkSLErrorReporter.h" | 15 #include "SkSLErrorReporter.h" |
| 15 | 16 |
| 16 namespace SkSL { | 17 namespace SkSL { |
| 17 | 18 |
| 18 class IRGenerator; | 19 class IRGenerator; |
| 19 | 20 |
| 20 /** | 21 /** |
| 21 * Main compiler entry point. This is a traditional compiler design which first
parses the .sksl | 22 * Main compiler entry point. This is a traditional compiler design which first
parses the .sksl |
| 22 * file into an abstract syntax tree (a tree of ASTNodes), then performs semanti
c analysis to | 23 * file into an abstract syntax tree (a tree of ASTNodes), then performs semanti
c analysis to |
| 23 * produce a Program (a tree of IRNodes), then feeds the Program into a CodeGene
rator to produce | 24 * produce a Program (a tree of IRNodes), then feeds the Program into a CodeGene
rator to produce |
| (...skipping 19 matching lines...) Expand all Loading... |
| 43 | 44 |
| 44 private: | 45 private: |
| 45 | 46 |
| 46 void internalConvertProgram(std::string text, | 47 void internalConvertProgram(std::string text, |
| 47 std::vector<std::unique_
ptr<ProgramElement>>* result); | 48 std::vector<std::unique_
ptr<ProgramElement>>* result); |
| 48 | 49 |
| 49 std::shared_ptr<SymbolTable> fTypes; | 50 std::shared_ptr<SymbolTable> fTypes; |
| 50 IRGenerator* fIRGenerator; | 51 IRGenerator* fIRGenerator; |
| 51 std::string fSkiaVertText; // FIXME store parsed version instead | 52 std::string fSkiaVertText; // FIXME store parsed version instead |
| 52 | 53 |
| 54 Context fContext; |
| 53 int fErrorCount; | 55 int fErrorCount; |
| 54 std::string fErrorText; | 56 std::string fErrorText; |
| 55 }; | 57 }; |
| 56 | 58 |
| 57 } // namespace | 59 } // namespace |
| 58 | 60 |
| 59 #endif | 61 #endif |
| OLD | NEW |