Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
GrammarFromXMLParser.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <alib/deque>
9#include <alib/set>
10#include <alib/variant>
11#include <alib/vector>
12
13#include <core/xmlApi.hpp>
14#include <sax/ParserException.h>
16
17namespace grammar {
18
23public:
24 template < class SymbolType >
26 template < class SymbolType >
28 template < class SymbolType >
30
32 bool generatesEpsilon;
35 ++input;
37 generatesEpsilon = true;
38 } else {
41 generatesEpsilon = false;
42 }
44 return generatesEpsilon;
45 }
46
47 template < class SymbolType >
49 template < class SymbolType >
51 template < class SymbolType >
53 template < class SymbolType >
55 template < class SymbolType >
57
58 template<class T>
60};
61
62template < class SymbolType >
64 ext::set<SymbolType> inputSymbols;
67 inputSymbols.insert(core::xmlApi<SymbolType>::parse(input));
68 }
70 return inputSymbols;
71}
72
73template < class SymbolType >
75 ext::set<SymbolType> inputSymbols;
78 inputSymbols.insert(core::xmlApi<SymbolType>::parse(input));
79 }
81 return inputSymbols;
82}
83
84template < class SymbolType >
89 return blank;
90}
91
92template < class SymbolType >
97 ++input;
100 lContext.push_back(core::xmlApi<SymbolType>::parse(input));
101 }
103 return lContext;
104}
105
106template < class SymbolType >
111 ++input;
114 lhs.push_back(core::xmlApi<SymbolType>::parse(input));
115 }
117 return lhs;
118}
119
120template < class SymbolType >
125 return lhs;
126}
127
128template < class SymbolType >
133 ++input;
136 rContext.push_back(core::xmlApi<SymbolType>::parse(input));
137 }
139 return rContext;
140}
141
142template < class SymbolType >
147 ++input;
150 rhs.push_back(core::xmlApi<SymbolType>::parse(input));
151 }
153 return rhs;
154}
155
156template<class T>
163 }
165}
166
167} /* namespace grammar */
168
Class extending the deque class from the standard library. Original reason is to allow printing of th...
Definition: deque.hpp:44
Definition: set.hpp:44
Class extending the vector class from the standard library. Original reason is to allow printing of t...
Definition: vector.hpp:45
Definition: GrammarFromXMLParser.h:22
static ext::vector< SymbolType > parseRuleRHS(ext::deque< sax::Token >::iterator &input)
Definition: GrammarFromXMLParser.h:143
static void parseRules(ext::deque< sax::Token >::iterator &input, T &grammar)
Definition: GrammarFromXMLParser.h:157
static SymbolType parseInitialSymbol(ext::deque< sax::Token >::iterator &input)
Definition: GrammarFromXMLParser.h:85
static ext::set< SymbolType > parseTerminalAlphabet(ext::deque< sax::Token >::iterator &input)
Definition: GrammarFromXMLParser.h:74
static SymbolType parseRuleSingleSymbolLHS(ext::deque< sax::Token >::iterator &input)
Definition: GrammarFromXMLParser.h:121
static ext::vector< SymbolType > parseRuleLHS(ext::deque< sax::Token >::iterator &input)
Definition: GrammarFromXMLParser.h:107
static bool parseGeneratesEpsilon(ext::deque< sax::Token >::iterator &input)
Definition: GrammarFromXMLParser.h:31
static ext::vector< SymbolType > parseRuleLContext(ext::deque< sax::Token >::iterator &input)
Definition: GrammarFromXMLParser.h:93
static ext::set< SymbolType > parseNonterminalAlphabet(ext::deque< sax::Token >::iterator &input)
Definition: GrammarFromXMLParser.h:63
static ext::vector< SymbolType > parseRuleRContext(ext::deque< sax::Token >::iterator &input)
Definition: GrammarFromXMLParser.h:129
static void popToken(ext::deque< Token >::iterator &input, Token::TokenType type, const std::string &data)
Definition: FromXMLParserHelper.cpp:39
static bool isToken(ext::deque< Token >::const_iterator input, Token::TokenType type, const std::string &data)
Definition: FromXMLParserHelper.cpp:29
static bool isTokenType(ext::deque< Token >::const_iterator input, Token::TokenType type)
Definition: FromXMLParserHelper.cpp:34
return grammar
Definition: ToGrammarLeftRG.h:99
typename T::SymbolType SymbolType
Definition: ReachableStates.h:176
Definition: ToAutomaton.h:24
Definition: xmlApi.hpp:27