1 #ifndef MSP_GL_SL_PARSER_H_
2 #define MSP_GL_SL_PARSER_H_
8 #include <msp/io/base.h>
47 unsigned source_index;
49 std::string::const_iterator iter;
50 std::string::const_iterator source_end;
51 bool allow_preprocess;
52 bool allow_stage_change;
53 std::string last_token;
54 std::deque<std::string> next_tokens;
57 std::set<std::string> declared_types;
59 static Operator operators[];
65 Module &parse(const std::string &, const std::string &, unsigned = 0);
66 Module &parse(IO::Base &, const std::string &, unsigned = 0);
71 const std::string &peek_token(unsigned = 0);
72 const std::string &parse_token();
73 std::string parse_token_();
74 std::string parse_identifier();
75 std::string parse_number();
76 std::string parse_other();
77 void skip_comment_and_whitespace();
78 void expect(const std::string &);
79 std::string expect_type();
80 std::string expect_identifier();
81 bool check(const std::string &);
83 static bool is_interface_qualifier(const std::string &);
84 static bool is_sampling_qualifier(const std::string &);
85 static bool is_interpolation_qualifier(const std::string &);
86 static bool is_precision_qualifier(const std::string &);
87 static bool is_qualifier(const std::string &);
88 static bool is_builtin_type(const std::string &);
89 bool is_type(const std::string &);
90 bool is_identifier(const std::string &);
93 void preprocess_version();
94 void preprocess_pragma();
95 void preprocess_pragma_msp();
96 void preprocess_stage();
98 RefPtr<Statement> parse_global_declaration();
99 RefPtr<Statement> parse_statement();
100 RefPtr<Import> parse_import();
101 RefPtr<Precision> parse_precision();
102 RefPtr<Layout> parse_layout();
103 void parse_block(Block &, bool);
104 RefPtr<Expression> parse_expression(unsigned = 0);
105 RefPtr<BinaryExpression> parse_binary(const RefPtr<Expression> &, const Operator *);
106 RefPtr<FunctionCall> parse_function_call(const VariableReference &);
107 RefPtr<StructDeclaration> parse_struct_declaration();
108 RefPtr<VariableDeclaration> parse_variable_declaration();
109 RefPtr<FunctionDeclaration> parse_function_declaration();
110 RefPtr<InterfaceBlock> parse_interface_block();
111 RefPtr<Conditional> parse_conditional();
112 RefPtr<Iteration> parse_for();
113 RefPtr<Iteration> parse_while();
114 RefPtr<Passthrough> parse_passthrough();
115 RefPtr<Return> parse_return();