]> git.localhorst.tv Git - l2e.git/blobdiff - src/loader/Parser.h
removed useless comments
[l2e.git] / src / loader / Parser.h
index b4f1b8d270b17ff93a02e2388bec310d0609743c..a1c98c83f188a9b5c19c9e20803adc91ec43d5a5 100644 (file)
@@ -1,14 +1,15 @@
-/*
- * Parser.h
- *
- *  Created on: Aug 26, 2012
- *      Author: holy
- */
-
 #ifndef LOADER_PARSER_H_
 #define LOADER_PARSER_H_
 
-#include "ParsedSource.h"
+namespace loader {
+       class Definition;
+       class Declaration;
+       class Literal;
+       class ParsedSource;
+       class PropertyList;
+       class Value;
+}
+
 #include "Tokenizer.h"
 
 #include <fstream>
 
 namespace loader {
 
-class Declaration;
-class Definition;
-class Literal;
-class PropertyList;
-
 class Parser {
 
 public:
-       Parser(const char *file, ParsedSource &product)
-       : file(file), in(file), tok(in), product(product) { }
+       Parser(const std::string &file, ParsedSource &product);
        ~Parser() { }
 private:
        Parser(const Parser &);
@@ -39,12 +34,13 @@ public:
 public:
        class Error: public std::runtime_error {
        public:
-               Error(const char *file, int line, const std::string &msg)
+               Error(const std::string &file, int line, const std::string &msg)
                : std::runtime_error(msg), file(file), line(line) { };
-               const char *File() const { return file; }
+               ~Error() throw() { }
+               const std::string &File() const { return file; }
                int Line() const { return line; }
        private:
-               const char *file;
+               std::string file;
                int line;
        };
 
@@ -66,15 +62,19 @@ private:
        Literal *ParseArray();
        Literal *ParseColor();
        Literal *ParseVector();
+       Literal *ParseScript();
 
 private:
        void AssertTokenType(Tokenizer::Token::Type actual, Tokenizer::Token::Type expected);
        void AssertTokenType(Tokenizer::Token::Type actual, Tokenizer::Token::Type expected, const std::string &msg);
        bool BeginningOfLiteral(const Tokenizer::Token &) const;
+       bool BeginningOfPrimitiveLiteral(const Tokenizer::Token &) const;
        bool BeginOfPropertyList(const Tokenizer::Token &) const;
+       bool BeginningOfScriptLiteral(const Tokenizer::Token &) const;
 
 private:
-       const char *file;
+       std::string file;
+       std::string dirname;
        std::ifstream in;
        Tokenizer tok;
        ParsedSource &product;
@@ -83,4 +83,4 @@ private:
 
 }
 
-#endif /* LOADER_PARSER_H_ */
+#endif