The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
tokenizer.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2007 - 2016 by David White <dave.net>
3  Part of the Silver Tree Project
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by or later.
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY.
9 
10  See the COPYING file for more details.
11 */
12 
13 #ifndef FORMULA_TOKENIZER_HPP_INCLUDED
14 #define FORMULA_TOKENIZER_HPP_INCLUDED
15 
16 #include <string>
17 
18 namespace formula_tokenizer
19 {
20 
21 typedef std::string::const_iterator iterator;
22 
23 /// TOKEN_TYPE is already defined in a Winnt.h (a windows header wich is included under some conditions.)
31 
32 struct token {
33 
34  token() :
36  begin(),
37  end(),
38  line_number(1),
39  filename()
40  {
41  }
42 
43  token(iterator& i1, iterator i2, TOKEN_TYPE type) :
44  type(type),
45  begin(i1),
46  end(i2),
47  line_number(1),
48  filename()
49  {
50  }
51 
53  iterator begin, end;
56 };
57 
58 token get_token(iterator& i1, iterator i2);
59 
61 {
63  token_error(const std::string& dsc, const std::string& formula) : description_(dsc), formula_(formula) {}
66 };
67 
68 }
69 
70 #endif
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1221
TOKEN_TYPE
TOKEN_TYPE is already defined in a Winnt.h (a windows header wich is included under some conditions...
Definition: tokenizer.hpp:24
token get_token(iterator &i1, const iterator i2)
Definition: tokenizer.cpp:38
GLuint GLuint end
Definition: glew.h:1221
token_error(const std::string &dsc, const std::string &formula)
Definition: tokenizer.hpp:63
const std::string * filename
Definition: tokenizer.hpp:55
std::string::const_iterator iterator
Definition: tokenizer.hpp:21
GLsizei const GLcharARB ** string
Definition: glew.h:4503
token(iterator &i1, iterator i2, TOKEN_TYPE type)
Definition: tokenizer.hpp:43