Shader: Add support for function attributes (entry)

This commit is contained in:
Jérôme Leclercq
2021-03-13 16:10:01 +01:00
parent a318b28cd6
commit 9d8ce8f2cd
11 changed files with 123 additions and 29 deletions

View File

@@ -57,14 +57,15 @@ namespace Nz::ShaderLang
const Token& Advance();
void Consume(std::size_t count = 1);
const Token& Expect(const Token& token, TokenType type);
const Token& ExpectNot(const Token& token, TokenType type);
const Token& Expect(TokenType type);
const Token& Peek(std::size_t advance = 0);
std::vector<ShaderAst::Attribute> ParseAttributes();
void HandleAttributes();
// Statements
std::vector<ShaderAst::StatementPtr> ParseFunctionBody();
ShaderAst::StatementPtr ParseFunctionDeclaration();
ShaderAst::StatementPtr ParseFunctionDeclaration(std::vector<ShaderAst::Attribute> attributes = {});
ShaderAst::DeclareFunctionStatement::Parameter ParseFunctionParameter();
ShaderAst::StatementPtr ParseReturnStatement();
ShaderAst::StatementPtr ParseStatement();
@@ -87,7 +88,6 @@ namespace Nz::ShaderLang
struct Context
{
std::vector<ShaderAst::Attribute> pendingAttributes;
std::unique_ptr<ShaderAst::MultiStatement> root;
std::size_t tokenCount;
std::size_t tokenIndex = 0;