2 // Copyright (C) 2006 Matthias Braun <matze@braunis.de>
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #ifndef HEADER_SUPERTUX_LISP_PARSER_HPP
18 #define HEADER_SUPERTUX_LISP_PARSER_HPP
20 #include "lisp/lexer.hpp"
21 #include "obstack/obstack.h"
23 namespace tinygettext {
25 class DictionaryManager;
36 Parser(bool translate = true);
40 * Parses a lispfile and returns the s-expression structure.
41 * Note that all memory is held by the parser so don't destroy the parser
42 * before you are finished with the lisp tree
44 const Lisp* parse(const std::string& filename);
46 * Same as parse but reads from a generic std::istream. The sourcename is
47 * used for errormessages to indicate the source of the data.
49 const Lisp* parse(std::istream& stream, const std::string& sourcename);
52 void parse_error(const char* msg) const __attribute__((__noreturn__));
59 tinygettext::DictionaryManager* dictionary_manager;
60 tinygettext::Dictionary* dictionary;
61 Lexer::TokenType token;
66 Parser(const Parser&);
67 Parser & operator=(const Parser&);
70 } // end of namespace lisp