1 #ifndef MSP_GL_SL_PARSER_H_
2 #define MSP_GL_SL_PARSER_H_
6 #include <msp/io/base.h>
7 #include "preprocessor.h"
19 std::string source_name;
20 unsigned source_index;
22 Preprocessor preprocessor;
23 bool allow_stage_change;
26 std::set<std::string> declared_types;
32 Module &parse(const std::string &, const std::string &, unsigned = 0);
33 Module &parse(IO::Base &, const std::string &, unsigned = 0);
36 void parse_source(const std::string &);
37 void set_required_version(const Version &);
38 void stage_change(Stage::Type);
40 std::string expect_type();
41 std::string expect_identifier();
42 bool check(const std::string &);
44 static bool is_interface_qualifier(const std::string &);
45 static bool is_sampling_qualifier(const std::string &);
46 static bool is_interpolation_qualifier(const std::string &);
47 static bool is_precision_qualifier(const std::string &);
48 static bool is_qualifier(const std::string &);
49 static bool is_builtin_type(const std::string &);
50 bool is_type(const std::string &);
51 bool is_identifier(const std::string &);
54 void preprocess_version();
55 void preprocess_pragma();
56 void preprocess_pragma_msp();
57 void preprocess_stage();
59 RefPtr<Statement> parse_global_declaration();
60 RefPtr<Statement> parse_statement();
61 RefPtr<Import> parse_import();
62 RefPtr<Precision> parse_precision();
63 RefPtr<Layout> parse_layout();
64 void parse_block(Block &, bool);
65 RefPtr<Expression> parse_expression(unsigned = 0);
66 RefPtr<BinaryExpression> parse_binary(const RefPtr<Expression> &, const Operator *);
67 RefPtr<FunctionCall> parse_function_call(const VariableReference &);
68 RefPtr<StructDeclaration> parse_struct_declaration();
69 RefPtr<VariableDeclaration> parse_variable_declaration();
70 RefPtr<FunctionDeclaration> parse_function_declaration();
71 RefPtr<InterfaceBlock> parse_interface_block();
72 RefPtr<Conditional> parse_conditional();
73 RefPtr<Iteration> parse_for();
74 RefPtr<Iteration> parse_while();
75 RefPtr<Passthrough> parse_passthrough();
76 RefPtr<Return> parse_return();