formula_tokenizer.hpp

Go to the documentation of this file.
00001 /* $Id: formula_tokenizer.hpp 25713 2008-04-09 18:36:16Z dragonking $ */
00002 /*
00003    Copyright (C) 2007 - 2008 by David White <dave.net>
00004    Part of the Silver Tree Project
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License version 2 or later.
00008    This program is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY.
00010 
00011    See the COPYING file for more details.
00012 */
00013 
00014 #ifndef FORMULA_TOKENIZER_HPP_INCLUDED
00015 #define FORMULA_TOKENIZER_HPP_INCLUDED
00016 
00017 #include <string>
00018 
00019 namespace formula_tokenizer
00020 {
00021 
00022 typedef std::string::const_iterator iterator;
00023 
00024 enum TOKEN_TYPE { TOKEN_OPERATOR, TOKEN_STRING_LITERAL,
00025                   TOKEN_IDENTIFIER, TOKEN_INTEGER,
00026                   TOKEN_LPARENS, TOKEN_RPARENS,
00027                   TOKEN_LSQUARE, TOKEN_RSQUARE, 
00028                   TOKEN_LBRACKET, TOKEN_RBRACKET,
00029                   TOKEN_COMMA, TOKEN_SEMICOLON, 
00030                   TOKEN_WHITESPACE, TOKEN_KEYWORD,
00031                   TOKEN_COMMENT, TOKEN_POINTER  };
00032 
00033 struct token {
00034     TOKEN_TYPE type;
00035     iterator begin, end;
00036 };
00037 
00038 token get_token(iterator& i1, iterator i2);
00039 
00040 struct token_error {};
00041 
00042 }
00043 
00044 #endif

Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs