aboutsummaryrefslogtreecommitdiff
path: root/MoonParser/parser.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'MoonParser/parser.hpp')
-rw-r--r--MoonParser/parser.hpp39
1 files changed, 17 insertions, 22 deletions
diff --git a/MoonParser/parser.hpp b/MoonParser/parser.hpp
index b280155..66d6067 100644
--- a/MoonParser/parser.hpp
+++ b/MoonParser/parser.hpp
@@ -13,8 +13,23 @@
13#include <string> 13#include <string>
14#include <list> 14#include <list>
15#include <functional> 15#include <functional>
16#include <codecvt>
17#include <locale>
16 18
17 19
20///type of the parser's input.
21typedef std::basic_string<char32_t> input;
22typedef input::iterator input_it;
23
24template<class Facet>
25struct deletable_facet : Facet
26{
27 template<class ...Args>
28 deletable_facet(Args&& ...args): Facet(std::forward<Args>(args)...) {}
29 ~deletable_facet() {}
30};
31typedef std::wstring_convert<deletable_facet<std::codecvt<input::value_type, char, std::mbstate_t>>, input::value_type> Converter;
32
18namespace parserlib { 33namespace parserlib {
19 34
20 35
@@ -24,9 +39,6 @@ class _context;
24class rule; 39class rule;
25 40
26 41
27///type of the parser's input.
28typedef std::u32string input;
29typedef input::iterator input_it;
30struct item_t 42struct item_t
31{ 43{
32 input_it begin; 44 input_it begin;
@@ -65,18 +77,13 @@ public:
65 /** character terminal constructor. 77 /** character terminal constructor.
66 @param c character. 78 @param c character.
67 */ 79 */
68 expr(int c); 80 expr(char c);
69 81
70 /** null-terminated string terminal constructor. 82 /** null-terminated string terminal constructor.
71 @param s null-terminated string. 83 @param s null-terminated string.
72 */ 84 */
73 expr(const char *s); 85 expr(const char *s);
74 86
75 /** null-terminated wide string terminal constructor.
76 @param s null-terminated string.
77 */
78 expr(const wchar_t *s);
79
80 /** rule reference constructor. 87 /** rule reference constructor.
81 @param r rule. 88 @param r rule.
82 */ 89 */
@@ -195,18 +202,13 @@ public:
195 /** character terminal constructor. 202 /** character terminal constructor.
196 @param c character. 203 @param c character.
197 */ 204 */
198 rule(int c); 205 rule(char c);
199 206
200 /** null-terminated string terminal constructor. 207 /** null-terminated string terminal constructor.
201 @param s null-terminated string. 208 @param s null-terminated string.
202 */ 209 */
203 rule(const char *s); 210 rule(const char *s);
204 211
205 /** null-terminated wide string terminal constructor.
206 @param s null-terminated string.
207 */
208 rule(const wchar_t *s);
209
210 /** constructor from expression. 212 /** constructor from expression.
211 @param e expression. 213 @param e expression.
212 */ 214 */
@@ -330,13 +332,6 @@ expr term(const expr &e);
330expr set(const char *s); 332expr set(const char *s);
331 333
332 334
333/** creates a set expression from a null-terminated wide string.
334 @param s null-terminated string with characters of the set.
335 @return an expression which parses a single character out of a set.
336 */
337expr set(const wchar_t *s);
338
339
340/** creates a range expression. 335/** creates a range expression.
341 @param min min character. 336 @param min min character.
342 @param max max character. 337 @param max max character.