+++ /dev/null
-#ifndef MSP_GL_PROGRAMPARSER_H_
-#define MSP_GL_PROGRAMPARSER_H_
-
-#include <deque>
-#include <map>
-#include <set>
-#include <string>
-#include <msp/io/base.h>
-#include "programsyntax.h"
-
-namespace Msp {
-namespace GL {
-
-class ProgramParser
-{
-private:
- enum OperatorType
- {
- NO_OPERATOR,
- BINARY,
- PREFIX,
- POSTFIX
- };
-
- enum Associativity
- {
- LEFT_TO_RIGHT,
- RIGHT_TO_LEFT
- };
-
- struct Operator
- {
- const char token[4];
- unsigned precedence;
- OperatorType type;
- Associativity assoc;
- };
-
- std::string source;
- std::string::const_iterator iter;
- std::deque<std::string> next_tokens;
- ProgramSyntax::Module *module;
- ProgramSyntax::Stage *cur_stage;
- std::set<std::string> declared_types;
-
- static Operator operators[];
-
-public:
- ProgramParser();
- ~ProgramParser();
-
- ProgramSyntax::Module &parse(const std::string &);
- ProgramSyntax::Module &parse(IO::Base &);
-
-private:
- void parse_source();
-
- const std::string &peek_token(unsigned = 0);
- std::string parse_token();
- std::string parse_token_();
- std::string parse_identifier();
- std::string parse_number();
- std::string parse_other();
- bool skip_comment_and_whitespace();
- void expect(const std::string &);
- std::string expect_type();
- std::string expect_identifier();
- bool check(const std::string &);
-
- static bool is_interface_qualifier(const std::string &);
- static bool is_sampling_qualifier(const std::string &);
- static bool is_qualifier(const std::string &);
- static bool is_builtin_type(const std::string &);
- bool is_type(const std::string &);
- bool is_identifier(const std::string &);
-
- ProgramSyntax::Node *parse_global_declaration();
- ProgramSyntax::Node *parse_statement();
- ProgramSyntax::Layout *parse_layout();
- void parse_block(ProgramSyntax::Block &, bool);
- ProgramSyntax::Expression *parse_expression(unsigned = 0);
- ProgramSyntax::BinaryExpression *parse_binary(ProgramSyntax::Expression *, const Operator *);
- ProgramSyntax::FunctionCall *parse_function_call(ProgramSyntax::VariableReference *);
- ProgramSyntax::StructDeclaration *parse_struct_declaration();
- ProgramSyntax::VariableDeclaration *parse_variable_declaration();
- ProgramSyntax::FunctionDeclaration *parse_function_declaration();
- ProgramSyntax::InterfaceBlock *parse_interface_block();
- ProgramSyntax::Conditional *parse_conditional();
- ProgramSyntax::Iteration *parse_iteration();
- ProgramSyntax::Passthrough *parse_passthrough();
- ProgramSyntax::Return *parse_return();
-};
-
-} // namespace GL
-} // namespace Msp
-
-#endif