Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
SymbolOrEpsilon.h
Go to the documentation of this file.
1
6#pragma once
7
9#include <core/xmlApi.hpp>
10
11namespace core {
12
13template < class T >
14struct xmlApi < common::symbol_or_epsilon < T > > {
16 static bool first ( const ext::deque < sax::Token >::const_iterator & input );
17 static std::string xmlTagName ( );
18 static void compose ( ext::deque < sax::Token > & output, const common::symbol_or_epsilon < T > & input );
19};
20
21template < typename T >
24 ++input;
27 } else {
29 }
30}
31
32template < typename T >
35}
36
37template < typename T >
38std::string xmlApi < common::symbol_or_epsilon < T > >::xmlTagName ( ) {
39 throw exception::CommonException ( "Symbol of epsilon should not provide xmlTagName call." );
40}
41
42template < typename T >
44 if ( input.is_epsilon ( ) ) {
45 output.emplace_back("epsilon", sax::Token::TokenType::START_ELEMENT);
46 output.emplace_back("epsilon", sax::Token::TokenType::END_ELEMENT);
47 } else {
48 core::xmlApi<T>::compose(output, input.getSymbol ( ) );
49 }
50}
51
52} /* namespace core */
53
Definition: symbol_or_epsilon.hpp:24
const SymbolType & getSymbol() const &
Definition: symbol_or_epsilon.hpp:41
bool is_epsilon() const
Definition: symbol_or_epsilon.hpp:58
Basic exception from which all other exceptions are derived.
Definition: CommonException.h:21
Class extending the deque class from the standard library. Original reason is to allow printing of th...
Definition: deque.hpp:44
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
Definition: Permutation.hpp:18
Definition: normalize.hpp:10
Definition: xmlApi.hpp:27