X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fprogramparser.h;h=e36604736b9f5cf4dfd28548038b87c371d76834;hp=4e8e38f0fcd48fb0c5033ffae76bad2add532783;hb=HEAD;hpb=a0caabaed3aeb8947133d78986bfb4ae5ae3c893 diff --git a/source/programparser.h b/source/programparser.h deleted file mode 100644 index 4e8e38f0..00000000 --- a/source/programparser.h +++ /dev/null @@ -1,98 +0,0 @@ -#ifndef MSP_GL_PROGRAMPARSER_H_ -#define MSP_GL_PROGRAMPARSER_H_ - -#include -#include -#include -#include -#include -#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 next_tokens; - ProgramSyntax::Module *module; - ProgramSyntax::Stage *cur_stage; - std::set 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::Import *parse_import(); - 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