X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fparser.h;fp=source%2Fparser.h;h=107bb3f9c53b83256e441f6ac6f4de5446e8658c;hb=5453824394771ca21de32088a2842486b63e6f6d;hp=0000000000000000000000000000000000000000;hpb=7876adf8729437f1c917642c5dd5faf6f2e1fb31;p=libs%2Fdatafile.git diff --git a/source/parser.h b/source/parser.h new file mode 100644 index 0000000..107bb3f --- /dev/null +++ b/source/parser.h @@ -0,0 +1,42 @@ +/* +This file is part of libmspparser +Copyright © 2006 Mikko Rasa, Mikkosoft Productions +Distributed under the LGPL +*/ +#ifndef MSP_PARSER_PARSER_H_ +#define MSP_PARSER_PARSER_H_ + +#include +#include +#include "input.h" + +namespace Msp { +namespace Parser { + +class Statement; +struct Token; + +class Parser +{ +public: + Parser(std::istream &, const std::string &); + Statement parse(); + operator bool() const { return (bool)in; } +private: + Input in; + std::string src; + bool good; + + Statement parse_(const Token *); + Token parse_token(); + bool is_delimiter(int); + bool isodigit(int); + std::string unescape_string(const std::string &); + std::string get_location(); + void parse_error(int, int); +}; + +} // namespace Parser +} // namespace Msp + +#endif