1 #ifndef LOADER_PARSER_H_
2 #define LOADER_PARSER_H_
5 #include "ParsedSource.h"
18 Parser(const std::string &file, ParsedSource &product);
21 Parser(const Parser &);
22 Parser &operator =(const Parser &);
28 class Error: public std::runtime_error {
30 Error(const std::string &file, int line, const std::string &msg)
31 : std::runtime_error(msg), file(file), line(line) { };
33 const std::string &File() const { return file; }
34 int Line() const { return line; }
41 Tokenizer::Token GetToken();
42 void ParseStatement();
43 void ParseExportDirective();
44 void ParseIncludeDirective();
46 Declaration *ProbeDefinition();
47 Definition *ParseDefinition();
49 std::string ParseIdentifier();
50 std::string ParseTypeName();
53 PropertyList *ParsePropertyList();
54 Literal *ParseLiteral();
55 Literal *ParseArray();
56 Literal *ParseColor();
57 Literal *ParseVector();
58 Literal *ParseScript();
61 void AssertTokenType(Tokenizer::Token::Type actual, Tokenizer::Token::Type expected);
62 void AssertTokenType(Tokenizer::Token::Type actual, Tokenizer::Token::Type expected, const std::string &msg);
63 bool BeginningOfLiteral(const Tokenizer::Token &) const;
64 bool BeginningOfPrimitiveLiteral(const Tokenizer::Token &) const;
65 bool BeginOfPropertyList(const Tokenizer::Token &) const;
66 bool BeginningOfScriptLiteral(const Tokenizer::Token &) const;
73 ParsedSource &product;
79 #endif /* LOADER_PARSER_H_ */