1 #ifndef MSP_GL_PROGRAMPARSER_H_
2 #define MSP_GL_PROGRAMPARSER_H_
8 #include <msp/io/base.h>
9 #include "programsyntax.h"
40 std::string::const_iterator iter;
41 std::deque<std::string> next_tokens;
42 ProgramSyntax::Module *module;
43 ProgramSyntax::Stage *cur_stage;
44 std::set<std::string> declared_types;
46 static Operator operators[];
52 ProgramSyntax::Module &parse(const std::string &);
53 ProgramSyntax::Module &parse(IO::Base &);
58 const std::string &peek_token(unsigned = 0);
59 std::string parse_token();
60 std::string parse_token_();
61 std::string parse_identifier();
62 std::string parse_number();
63 std::string parse_other();
64 bool skip_comment_and_whitespace();
65 void expect(const std::string &);
66 std::string expect_type();
67 std::string expect_identifier();
68 bool check(const std::string &);
70 static bool is_interface_qualifier(const std::string &);
71 static bool is_sampling_qualifier(const std::string &);
72 static bool is_qualifier(const std::string &);
73 static bool is_builtin_type(const std::string &);
74 bool is_type(const std::string &);
75 bool is_identifier(const std::string &);
77 ProgramSyntax::Node *parse_global_declaration();
78 ProgramSyntax::Node *parse_statement();
79 ProgramSyntax::Layout *parse_layout();
80 void parse_block(ProgramSyntax::Block &, bool);
81 ProgramSyntax::Expression *parse_expression(unsigned = 0);
82 ProgramSyntax::BinaryExpression *parse_binary(ProgramSyntax::Expression *, const Operator *);
83 ProgramSyntax::FunctionCall *parse_function_call(ProgramSyntax::VariableReference *);
84 ProgramSyntax::StructDeclaration *parse_struct_declaration();
85 ProgramSyntax::VariableDeclaration *parse_variable_declaration();
86 ProgramSyntax::FunctionDeclaration *parse_function_declaration();
87 ProgramSyntax::InterfaceBlock *parse_interface_block();
88 ProgramSyntax::Conditional *parse_conditional();
89 ProgramSyntax::Iteration *parse_iteration();
90 ProgramSyntax::Passthrough *parse_passthrough();
91 ProgramSyntax::Return *parse_return();