basix_doc 0.1
|
00001 00002 /****************************************************************************** 00003 * MODULE : parse_tools.hpp 00004 * DESCRIPTION: Tools for parsing 00005 * COPYRIGHT : (C) 2007 Gregoire Lecerf 00006 ******************************************************************************* 00007 * This software falls under the GNU general public license and comes WITHOUT 00008 * ANY WARRANTY WHATSOEVER. See the file $TEXMACS_PATH/LICENSE for more details. 00009 * If you don't have this file, write to the Free Software Foundation, Inc., 00010 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00011 ******************************************************************************/ 00012 00013 #ifndef __PARSE_TOOLS_HPP 00014 #define __PARSE_TOOLS_HPP 00015 #include <basix/source_track.hpp> 00016 #include <basix/table.hpp> 00017 #include <basix/compound.hpp> 00018 00020 00021 namespace mmx { 00022 00023 struct parse_instance { 00024 MMX_ALLOCATORS 00025 // internal data for the parser 00026 string lex_file_name; // name of the stream 00027 // "" is reserved for stdin 00028 nat lex_input_number; // number of the input in interactive mode 00029 00030 char* lex_string; // part of the stream to be parsed and 00031 // starting at the above specified offset 00032 00033 nat lex_length; // length of lex_string 00034 00035 nat lex_start; // source_positions in lex_string used in the lexer 00036 nat lex_start_line; 00037 nat lex_start_begin_line; 00038 00039 nat lex_prev; 00040 nat lex_prev_line; 00041 nat lex_prev_begin_line; 00042 00043 nat lex_pos; // current source_position in lex_string in the lexer 00044 nat lex_line; 00045 nat lex_begin_line; 00046 00047 generic result; // output of the parser 00048 00049 list<generic> errors; // list of syntax error and warning 00050 00051 parse_instance (const string& f, nat i, const string& s); 00052 // Setup with lex_file_name f, lex_string s and lex_input_number i 00053 }; 00054 00055 } // namespace mmx 00056 #endif // __PARSE_TOOLS_HPP