4 * Created on: Aug 26, 2012
8 #ifndef LOADER_PARSER_H_
9 #define LOADER_PARSER_H_
11 #include "ParsedSource.h"
12 #include "Tokenizer.h"
28 Parser(std::istream &in, ParsedSource &product) : tok(in), product(product) { }
31 Parser(const Parser &);
32 Parser &operator =(const Parser &);
38 class ParseError: public std::runtime_error {
40 explicit ParseError(const std::string &msg) : std::runtime_error(msg) { };
44 void ParseStatement();
45 void ParseExportDirective();
46 void ParseIncludeDirective();
48 Declaration *ProbeDefinition();
49 Definition *ParseDefinition();
51 std::string ParseIdentifier();
52 std::string ParseTypeName();
55 PropertyList *ParsePropertyList();
56 Literal *ParseLiteral();
57 Literal *ParseArray();
58 Literal *ParseColor();
59 Literal *ParseVector();
62 void AssertTokenType(Tokenizer::Token::Type actual, Tokenizer::Token::Type expected);
63 void AssertTokenType(Tokenizer::Token::Type actual, Tokenizer::Token::Type expected, const std::string &msg);
64 bool BeginningOfLiteral(const Tokenizer::Token &) const;
65 bool BeginOfPropertyList(const Tokenizer::Token &) const;
69 ParsedSource &product;
75 #endif /* LOADER_PARSER_H_ */