Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
RankedPattern.h
Go to the documentation of this file.
1
6#pragma once
7
9#include <core/stringApi.hpp>
10
12
15
16namespace core {
17
18template<class SymbolType >
19struct stringApi < tree::RankedPattern < SymbolType > > {
20 static tree::RankedPattern < SymbolType > parse ( ext::istream & input );
21 static bool first ( ext::istream & input );
22 static void compose ( ext::ostream & output, const tree::RankedPattern < SymbolType > & tree );
23};
24
25template<class SymbolType >
27 tree::TreeFromStringLexer::Token token = tree::TreeFromStringLexer::next ( input );
29 throw exception::CommonException ( "Unrecognised RANKED_PATTERN token." );
30
33 bool isPattern = false;
34
35 ext::tree < common::ranked_symbol < SymbolType > > content = tree::TreeFromStringParserCommon::parseRankedContent < SymbolType > ( input, isPattern, nonlinearVariables, nodeWildcards );
36
37 if ( !nonlinearVariables.empty ( ) )
38 throw exception::CommonException ( "Unexpected variables recognised" );
39 if ( ! nodeWildcards.empty ( ) )
40 throw exception::CommonException ( "Unexpected node wildcards recognised" );
41
43}
44
45template<class SymbolType >
47 tree::TreeFromStringLexer::Token token = tree::TreeFromStringLexer::next ( input );
50 return res;
51}
52
53template<class SymbolType >
55 output << "RANKED_PATTERN ";
56 tree::TreeToStringComposerCommon::compose ( output, tree.getSubtreeWildcard ( ), tree.getContent ( ) );
57}
58
59} /* namespace core */
60
static Base instance()
Factory for the symbol construction of the symbol based on given type.
Definition: WildcardSymbol.h:83
Definition: ranked_symbol.hpp:20
Basic exception from which all other exceptions are derived.
Definition: CommonException.h:21
static void putback(ext::istream &input, const Token &token)
Definition: lexer.hpp:61
Definition: istream.h:32
Definition: ostream.h:14
Definition: set.hpp:44
Class introducing a tree with interface trying to be close to the interface of standard library conta...
Definition: tree.hpp:52
Tree pattern represented in its natural representation. The representation is so called ranked,...
Definition: RankedPattern.h:72
static Token next(ext::istream &input)
Definition: TreeFromStringLexer.cpp:10
static void compose(ext::ostream &, const ext::tree< common::ranked_symbol< SymbolType > > &node)
Definition: TreeToStringComposerCommon.h:28
return res
Definition: MinimizeByPartitioning.h:145
Definition: normalize.hpp:10
Definition: BackwardOccurrenceTest.h:17
Definition: stringApi.hpp:26