4
Copyright (C) 2005-2010 Julien Jorge, Sebastien Angibaud
6
This program is free software; you can redistribute it and/or modify it
7
under the terms of the GNU General Public License as published by the
8
Free Software Foundation; either version 2 of the License, or (at your
9
option) any later version.
11
This program is distributed in the hope that it will be useful, but WITHOUT
12
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16
You should have received a copy of the GNU General Public License along
17
with this program; if not, write to the Free Software Foundation, Inc.,
18
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
contact: plee-the-bear@gamned.org
22
Please add the tag [Bear] in the subject of your mails.
25
* \file script_parser.hpp
26
* \brief The parser for the script files.
27
* \author Julien Jorge
29
#ifndef __ENGINE_SCRIPT_PARSER_HPP__
30
#define __ENGINE_SCRIPT_PARSER_HPP__
32
#include "engine/class_export.hpp"
34
#include <boost/spirit/include/classic.hpp>
35
#include <boost/spirit/include/classic_position_iterator.hpp>
36
#include <boost/spirit/include/classic_parse_tree.hpp>
47
* \brief The parser for the script files.
48
* \author Julien Jorge
50
class ENGINE_EXPORT script_parser
53
typedef boost::spirit::classic::position_iterator<const char*> iterator;
55
boost::spirit::classic::node_iter_data_factory<iterator> node_factory;
57
boost::spirit::classic::tree_match<iterator, node_factory> tree_match;
58
typedef tree_match::node_t tree_node;
61
typedef boost::spirit::classic::scanner<iterator> scanner;
64
bool run( call_sequence& seq, const std::string& path );
65
bool run( call_sequence& seq, const std::istream& in_file );
67
( call_sequence& seq, const char* file_data, unsigned int file_size );
70
void scan_tree( call_sequence& seq, const tree_node& node );
72
}; // class script_parser
76
#endif // __ENGINE_SCRIPT_PARSER_HPP__