The Battle for Wesnoth  1.13.10+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) 2003 - 2017 by David White <dave@whitevine.net>
3  Part of the Battle for Wesnoth Project http://www.wesnoth.org/
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
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 #pragma once
16 
17 #include <string>
18 
19 namespace wfl
20 {
21 namespace tokenizer
22 {
23 
24 typedef std::string::const_iterator iterator;
25 
26 /// TOKEN_TYPE is already defined in a Winnt.h (a windows header wich is included under some conditions.)
34 
35 struct token {
36 
37  token() :
39  begin(),
40  end(),
41  line_number(1),
42  filename()
43  {
44  }
45 
46  token(iterator& i1, iterator i2, TOKEN_TYPE type) :
47  type(type),
48  begin(i1),
49  end(i2),
50  line_number(1),
51  filename()
52  {
53  }
54 
56  iterator begin, end;
59 };
60 
61 token get_token(iterator& i1, iterator i2);
62 
64 {
66  token_error(const std::string& dsc, const std::string& formula) : description_(dsc), formula_(formula) {}
69 };
70 
71 }
72 
73 }
TOKEN_TYPE
TOKEN_TYPE is already defined in a Winnt.h (a windows header wich is included under some conditions...
Definition: tokenizer.hpp:27
std::vector< char_t > string
Abstract baseclass for the tokenizer.
Definition: tokenizer.hpp:57
const std::string * filename
Definition: tokenizer.hpp:58
token get_token(iterator &i1, const iterator i2)
Definition: tokenizer.cpp:42
token(iterator &i1, iterator i2, TOKEN_TYPE type)
Definition: tokenizer.hpp:46
Definition: contexts.hpp:42
std::string::const_iterator iterator
Definition: tokenizer.hpp:24
token_error(const std::string &dsc, const std::string &formula)
Definition: tokenizer.hpp:66