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
22 #include "lisp/lexer.hpp"
24 namespace tinygettext {
26 class DictionaryManager;
37 Parser(bool translate = true);
41 * Parses a lispfile and returns the s-expression structure.
42 * Note that all memory is held by the parser so don't destroy the parser
43 * before you are finished with the lisp tree
45 const Lisp* parse(const std::string& filename);
47 * Same as parse but reads from a generic std::istream. The sourcename is
48 * used for errormessages to indicate the source of the data.
50 const Lisp* parse(std::istream& stream, const std::string& sourcename);
53 void parse_error(const char* msg) const __attribute__((__noreturn__));
60 tinygettext::DictionaryManager* dictionary_manager;
61 tinygettext::Dictionary* dictionary;
62 Lexer::TokenType token;
67 Parser(const Parser&);
68 Parser & operator=(const Parser&);
71 } // end of namespace lisp