Nesting namespace declarations

parent e567cede
......@@ -8,9 +8,7 @@
#include "RandomAutomatonFactory.h"
#include <registration/AlgoRegistration.hpp>
namespace automaton {
namespace generate {
namespace automaton::generate {
automaton::NFA < std::string, unsigned > RandomAutomatonFactory::generateNFA( size_t statesCount, size_t alphabetSize, bool randomizedAlphabet, double density ) {
if(alphabetSize > 26)
......@@ -52,9 +50,7 @@ unsigned RandomAutomatonFactory::ithInaccessibleState ( const ext::deque < bool
throw std::logic_error ( "Not enough states in deque of visited states" );
}
} /* namespace generate */
} /* namespace automaton */
} /* namespace automaton::generate */
namespace {
......
......@@ -8,9 +8,7 @@
#include "RandomTreeAutomatonFactory.h"
#include <registration/AlgoRegistration.hpp>
namespace automaton {
namespace generate {
namespace automaton::generate {
automaton::NFTA < std::string, unsigned > RandomTreeAutomatonFactory::generateNFTA( size_t statesCount, size_t alphabetSize, size_t maxRank, bool randomizedAlphabet, double density ) {
if(alphabetSize > 26)
......@@ -71,9 +69,7 @@ unsigned RandomTreeAutomatonFactory::ithInaccessibleState ( const ext::deque < b
throw std::logic_error ( "Not enough states in deque of visited states" );
}
} /* namespace generate */
} /* namespace automaton */
} /* namespace automaton::generate */
namespace {
......
......@@ -22,9 +22,7 @@
#include <registration/CastRegistration.hpp>
#include <registration/AlgoRegistration.hpp>
namespace automaton {
namespace transform {
namespace automaton::transform {
automaton::RealTimeHeightDeterministicDPDA < > PDAToRHPDA::convert ( const automaton::RealTimeHeightDeterministicDPDA < > & pda ) {
return pda;
......@@ -178,9 +176,7 @@ automaton::RealTimeHeightDeterministicNPDA < > PDAToRHPDA::convert ( const autom
return res;
}
} /* namespace transform */
} /* namespace automaton */
} /* namespace automaton::transform */
namespace {
......
......@@ -22,9 +22,7 @@
#include <registration/CastRegistration.hpp>
#include <registration/AlgoRegistration.hpp>
namespace automaton {
namespace transform {
namespace automaton::transform {
template < class T >
void constructTransitions ( const ext::tuple < DefaultStateType, DefaultSymbolType, ext::vector < DefaultSymbolType > > & stFirst, const ext::map < DefaultStateType, ext::set < ext::tuple < ext::vector < DefaultSymbolType >, DefaultStateType, ext::vector < DefaultSymbolType > > > > & epsilonTransitions, const DefaultStateType & toState, ext::vector < DefaultSymbolType > pops, ext::vector < DefaultSymbolType > pushes, T & res ) {
......@@ -259,9 +257,7 @@ automaton::NPDA < > automaton::transform::RHPDAToPDA::convert ( const automaton:
return res;
}
} /* namespace transform */
} /* namespace automaton */
} /* namespace automaton::transform */
namespace {
......
......@@ -8,9 +8,7 @@
#include "RandomGrammarFactory.h"
#include <registration/AlgoRegistration.hpp>
namespace grammar {
namespace generate {
namespace grammar::generate {
grammar::CFG < std::string, std::string > grammar::generate::RandomGrammarFactory::generateCFG ( size_t nonterminalsCount, size_t terminalsCount, bool randomizedAlphabet, double density ) {
if(terminalsCount > 26)
......@@ -40,9 +38,7 @@ grammar::CFG < std::string, std::string > grammar::generate::RandomGrammarFactor
return grammar::generate::RandomGrammarFactory::randomCFG ( nonterminals, terminals, density );
}
} /* namespace generate */
} /* namespace grammar */
} /* namespace grammar::generate */
namespace {
......
......@@ -9,9 +9,7 @@
#include <regexp/formal/FormalRegExpElements.h>
#include <registration/AlgoRegistration.hpp>
namespace regexp {
namespace convert {
namespace regexp::convert {
automaton::EpsilonNFA < > regexp::convert::ToAutomatonThompson::convert(const regexp::FormalRegExp < > & regexp) {
//FIXME use actual algorithms that implement product alternation and iteration of re over automata and remove terrible TERRIBLE hack with dummy initial state
......@@ -211,9 +209,7 @@ void regexp::convert::ToAutomatonThompson::Unbounded::visit(const regexp::Unboun
tailArg = &(*automaton.getStates().find(tail));
}
} /* namespace convert */
} /* namespace regexp */
} /* namespace regexp::convert */
namespace {
......
......@@ -14,9 +14,7 @@
#include <registration/AlgoRegistration.hpp>
namespace regexp {
namespace generate {
namespace regexp::generate {
regexp::UnboundedRegExp < std::string > regexp::generate::RandomRegExpFactory::generateUnboundedRegExp( size_t leafNodes, size_t height, size_t alphabetSize, bool randomizedAlphabet ) {
if ( alphabetSize > 26 )
......@@ -147,9 +145,7 @@ ext::ptr_value < regexp::UnboundedRegExpElement < SymbolType > > regexp::generat
}
}
} /* namespace generate */
} /* namespace regexp */
} /* namespace regexp::generate */
namespace {
......
......@@ -11,9 +11,7 @@
#include <registration/AlgoRegistration.hpp>
namespace string {
namespace generate {
namespace string::generate {
string::LinearString < std::string > string::generate::RandomStringFactory::generateLinearString ( size_t size, size_t alphabetSize, bool randomizedAlphabet, bool integerSymbols ) {
if ( !integerSymbols ) return generateLinearString ( size, alphabetSize, randomizedAlphabet );
......@@ -57,9 +55,7 @@ string::LinearString < std::string > string::generate::RandomStringFactory::gene
return string::generate::RandomStringFactory::generateLinearString ( size, alphabet );
}
} /* namespace generate */
} /* namespace string */
} /* namespace string::generate */
namespace {
......
......@@ -28,9 +28,7 @@
#include <global/GlobalData.h>
namespace tree {
namespace generate {
namespace tree::generate {
struct Node {
char symbol;
......@@ -398,9 +396,7 @@ RankedNonlinearPattern < > RandomRankedNonlinearPatternFactory::generateRankedNo
return tree;
}
} /* namespace generate */
} /* namespace tree */
} /* namespace tree::generate */
namespace {
......
......@@ -17,9 +17,7 @@
#include <global/GlobalData.h>
namespace automaton {
namespace generate {
namespace automaton::generate {
automaton::DFA < std::string, unsigned > MinimizeGenerator::generateMinimizeDFA ( size_t statesMinimal, size_t statesDuplicates, size_t statesUnreachable, size_t statesUseless, size_t alphabetSize, bool randomizedAlphabet, double density, size_t expectedSteps ) {
size_t limit = 10000;
......@@ -69,9 +67,7 @@ automaton::DFA < std::string, unsigned > MinimizeGenerator::generateMinimizeDFA
throw exception::CommonException ( "Generating automaton for minimization failed." );
}
} /* namespace generate */
} /* namespace automaton */
} /* namespace automaton::generate */
namespace {
......
......@@ -8,9 +8,7 @@
#include "RandomAutomatonFactory2.h"
#include <registration/AlgoRegistration.hpp>
namespace automaton {
namespace generate {
namespace automaton::generate {
size_t RandomAutomatonFactory2::randomSourceState ( size_t statesMinimal, size_t visited, size_t depleted, const ext::deque < bool > & VStates, const ext::deque < bool > & DStates ) {
size_t y = ext::random_devices::semirandom() % ( visited - depleted ) + 1; // select y-th accessible state
......@@ -56,9 +54,7 @@ automaton::DFA < std::string, unsigned > RandomAutomatonFactory2::generateDFA( s
return RandomAutomatonFactory2::NonminimalDFA ( statesMinimal, statesDuplicates, statesUnreachable, statesUseless, alphabet, density );
}
} /* namespace generate */
} /* namespace automaton */
} /* namespace automaton::generate */
namespace {
......
......@@ -10,9 +10,7 @@
#include <grammar/ContextFree/CFG.h>
#include <common/createUnique.hpp>
namespace grammar {
namespace parsing {
namespace grammar::parsing {
void AbsorbTerminalSymbol::handleAbsobtion ( const grammar::CFG < > & orig, grammar::CFG < > & res, const DefaultSymbolType & terminal, const ext::set < DefaultSymbolType > & nonterminals, const ext::map < DefaultSymbolType, DefaultSymbolType > & nonterminalsPrimed ) {
for ( const DefaultSymbolType & nonterminal : nonterminals )
......@@ -78,6 +76,4 @@ void AbsorbTerminalSymbol::absorbTerminalSymbol ( grammar::CFG < > & grammar, co
grammar = res;
}
} /* namespace parsing */
} /* namespace grammar */
} /* namespace grammar::parsing */
......@@ -17,9 +17,7 @@
#include <grammar/properties/RecursiveNonterminal.h>
#include <registration/AlgoRegistration.hpp>
namespace grammar {
namespace parsing {
namespace grammar::parsing {
grammar::CFG < > DeterministicLL1Grammar::convert ( const grammar::CFG < > & param ) {
......@@ -82,6 +80,4 @@ grammar::CFG < > DeterministicLL1Grammar::convert ( const grammar::CFG < > & par
auto DeterministicLL1GrammarCFG = registration::AbstractRegister < DeterministicLL1Grammar, grammar::CFG < >, const grammar::CFG < > & > ( DeterministicLL1Grammar::convert );
} /* namespace parsing */
} /* namespace grammar */
} /* namespace grammar::parsing */
......@@ -9,9 +9,7 @@
#include <exception/CommonException.h>
namespace grammar {
namespace parsing {
namespace grammar::parsing {
ext::map < ext::pair < ext::vector < DefaultSymbolType >, DefaultSymbolType >, ext::vector < DefaultSymbolType > > DeterministicLL1ParseTable::parseTable ( const ext::map < ext::pair < ext::vector < DefaultSymbolType >, DefaultSymbolType >, ext::set < ext::vector < DefaultSymbolType > > > & parseTable ) {
......@@ -31,6 +29,4 @@ ext::map < ext::pair < ext::vector < DefaultSymbolType >, DefaultSymbolType >, e
return res;
}
} /* namespace parsing */
} /* namespace grammar */
} /* namespace grammar::parsing */
......@@ -10,9 +10,7 @@
#include "common/Substitute.h"
#include <grammar/ContextFree/CFG.h>
namespace grammar {
namespace parsing {
namespace grammar::parsing {
void ExtractRightContext::extractRightContext ( grammar::CFG < > & grammar, const DefaultSymbolType & terminal, const ext::set < DefaultSymbolType > & nonterminals ) {
grammar::CFG < > res ( grammar.getInitialSymbol ( ) );
......@@ -41,6 +39,4 @@ void ExtractRightContext::extractRightContext ( grammar::CFG < > & grammar, cons
grammar = res;
}
} /* namespace parsing */
} /* namespace grammar */
} /* namespace grammar::parsing */
......@@ -12,9 +12,7 @@
#include <grammar/ContextFree/CFG.h>
namespace grammar {
namespace parsing {
namespace grammar::parsing {
void HandleFirstFirstConflict::handleFirstFirstConflict ( grammar::CFG < > & grammar, const DefaultSymbolType & terminal, const DefaultSymbolType & nonterminal, const ext::set < ext::vector < ext::variant < DefaultSymbolType, DefaultSymbolType > > > & rhsds ) {
for ( const ext::vector < ext::variant < DefaultSymbolType, DefaultSymbolType > > & rhs : rhsds )
......@@ -26,6 +24,4 @@ void HandleFirstFirstConflict::handleFirstFirstConflict ( grammar::CFG < > & gra
LeftFactorize::leftFactorize ( grammar, terminal, nonterminal );
}
} /* namespace parsing */
} /* namespace grammar */
} /* namespace grammar::parsing */
......@@ -14,9 +14,7 @@
#include <grammar/ContextFree/CFG.h>
namespace grammar {
namespace parsing {
namespace grammar::parsing {
void HandleFirstFollowConflict::handleFirstFollowConflict ( grammar::CFG < > & grammar, const DefaultSymbolType & terminal, const DefaultSymbolType & nonterminal, const ext::set < ext::vector < ext::variant < DefaultSymbolType, DefaultSymbolType > > > & /* rhsds */ ) {
ext::set < DefaultSymbolType > nullableNonterminals = properties::NullableNonterminals::getNullableNonterminals ( grammar );
......@@ -61,6 +59,4 @@ void HandleFirstFollowConflict::handleFirstFollowConflict ( grammar::CFG < > & g
AbsorbTerminalSymbol::absorbTerminalSymbol ( grammar, terminal, symbolsEndingWithNonterminal );
}
} /* namespace parsing */
} /* namespace grammar */
} /* namespace grammar::parsing */
......@@ -11,9 +11,7 @@
#include <queue>
namespace grammar {
namespace parsing {
namespace grammar::parsing {
LR0Items LR0Parser::getClosure ( LR0Items items, const grammar::CFG < > & originalGrammar ) {
bool changed;
......@@ -108,6 +106,4 @@ automaton::DFA < ext::variant < DefaultSymbolType, DefaultSymbolType >, LR0Items
return lr0Automaton;
}
} /* namespace parsing */
} /* namespace grammar */
} /* namespace grammar::parsing */
......@@ -11,9 +11,7 @@
#include <stack>
#include <common/createUnique.hpp>
namespace grammar {
namespace parsing {
namespace grammar::parsing {
DefaultSymbolType LRParser::getEndOfInputSymbol ( const grammar::CFG < > & originalGrammar ) {
return common::createUnique ( DefaultSymbolType ( alphabet::EndSymbol ( ) ), originalGrammar.getTerminalAlphabet ( ), originalGrammar.getNonterminalAlphabet ( ) );
......@@ -71,6 +69,4 @@ bool LRParser::parse ( const LRActionTable & actionTable, const LRGotoTable & go
return false;
}
} /* namespace parsing */
} /* namespace grammar */
} /* namespace grammar::parsing */
......@@ -10,9 +10,7 @@
#include <grammar/ContextFree/CFG.h>
#include <common/createUnique.hpp>
namespace grammar {
namespace parsing {
namespace grammar::parsing {
void LeftFactorize::leftFactorize ( grammar::CFG < > & grammar, const DefaultSymbolType & terminal, const DefaultSymbolType & nonterminal ) {
grammar::CFG < > res ( grammar.getInitialSymbol ( ) );
......@@ -39,6 +37,4 @@ void LeftFactorize::leftFactorize ( grammar::CFG < > & grammar, const DefaultSym
grammar = res;
}
} /* namespace parsing */
} /* namespace grammar */
} /* namespace grammar::parsing */
......@@ -13,9 +13,7 @@
#include <exception/CommonException.h>
namespace grammar {
namespace parsing {
namespace grammar::parsing {
void SLR1ParseTable::insertToActionTable ( LRActionTable & actionTable, LRActionTable::key_type key, LRActionTable::mapped_type value ) {
std::pair<LRActionTable::iterator, bool> result = actionTable.emplace ( std::move ( key ), std::move ( value ) );
......@@ -80,6 +78,4 @@ LRGotoTable SLR1ParseTable::getGotoTable ( const grammar::CFG < > & originalGram
return gotoTable;
}
} /* namespace parsing */
} /* namespace grammar */
} /* namespace grammar::parsing */
......@@ -8,9 +8,7 @@
#include "Substitute.h"
#include <grammar/ContextFree/CFG.h>
namespace grammar {
namespace parsing {
namespace grammar::parsing {
void Substitute::substitute ( const grammar::CFG < > & orig, grammar::CFG < > & res, const DefaultSymbolType & origLHS, const ext::vector < ext::variant < DefaultSymbolType, DefaultSymbolType > > & origRHS, ext::vector < ext::variant < DefaultSymbolType, DefaultSymbolType > >::const_iterator nonterminal ) {
auto iter = orig.getRules ( ).find ( * nonterminal );
......@@ -25,6 +23,4 @@ void Substitute::substitute ( const grammar::CFG < > & orig, grammar::CFG < > &
}
}
} /* namespace parsing */
} /* namespace grammar */
} /* namespace grammar::parsing */
......@@ -10,9 +10,7 @@
#include <string/LinearStringTerminatingSymbol.h>
#include <registration/AlgoRegistration.hpp>
namespace stringology {
namespace indexing {
namespace stringology::indexing {
indexes::SuffixTrieTerminatingSymbol ExperimentalSuffixTrie::construct ( const string::LinearStringTerminatingSymbol & w ) {
indexes::SuffixTrieTerminatingSymbol res ( w.getAlphabet ( ), w.getTerminatingSymbol ( ) );
......@@ -32,9 +30,7 @@ indexes::SuffixTrieTerminatingSymbol ExperimentalSuffixTrie::construct ( const s
return res;
}
} /* namespace indexing */
} /* namespace stringology */
} /* namespace stringology::indexing */
namespace {
......
......@@ -19,9 +19,7 @@
#include <cstring>
namespace cli {
namespace builtin {
namespace cli::builtin {
std::vector < std::string> Dot::allowedTypes { "dot", "xdot", "ps", "pdf", "svg", "svgz", "fig", "png", "gif", "jpg", "jpeg", "json", "imap", "cmapx" };
......@@ -105,7 +103,4 @@ auto DotFile = registration::AbstractRegister < Dot, void, const std::string &,
@param outputType the type of dot created image\n\
@param outputFile the destination file name" );
} /* namespace builtin */
} /* namespace cli */
} /* namespace cli::builtin */
......@@ -13,9 +13,7 @@
#include <exception/CommonException.h>
namespace cli {
namespace builtin {
namespace cli::builtin {
std::string ReadFile::read ( const std::string & filename ) {
if ( filename == "-" ) {
......@@ -37,7 +35,4 @@ auto ReadFileString = registration::AbstractRegister < ReadFile, std::string, co
@param filename the name of read file\n\
@return the content of the file" );
} /* namespace builtin */
} /* namespace cli */
} /* namespace cli::builtin */
......@@ -12,9 +12,7 @@
#include <exception/CommonException.h>
namespace cli {
namespace builtin {
namespace cli::builtin {
void WriteFile::write ( const std::string & filename, const std::string & data ) {
if ( filename == "-" )
......@@ -34,7 +32,5 @@ auto WriteFileString = registration::AbstractRegister < WriteFile, void, const s
@param filename the name of written file\n\
@param data the content of the file" );
} /* namespace builtin */
} /* namespace cli */
} /* namespace cli::builtin */
......@@ -13,9 +13,7 @@
#include <climits>
#include <registration/AlgoRegistration.hpp>
namespace graph {
namespace maximum_flow {
namespace graph::maximum_flow {
enum State { FRESH, OPEN, CLOSED };
struct Context {
......@@ -205,9 +203,7 @@ Flow FordFulkerson::findMaximumFlow(const UndirectedGraph &graph,
// ---------------------------------------------------------------------------------------------------------------------
} // namespace maximum_flow
} // namespace graph
} // namespace graph::maximum_flow
// ---------------------------------------------------------------------------------------------------------------------
......
......@@ -16,9 +16,7 @@
#include <maximum_flow/FordFulkerson.hpp>
#include <registration/AlgoRegistration.hpp>
namespace graph {
namespace minimum_cut {
namespace graph::minimum_cut {
static maximum_flow::Capacity getCapacity(const DirectedGraph &graph) {
maximum_flow::Capacity capacity;
......@@ -143,9 +141,7 @@ Cut FordFulkerson::findMinimumCut(const UndirectedGraph &graph,
//auto BasicAlgorithmUndirectedGraph = registration::OverloadRegister < FordFulkerson, UndirectedGraph, UndirectedGraph > ( FordFulkerson::findMinimumCut );
} // namespace minimumcut
} // namespace graph
} // namespace graph:minimum_cut
// ---------------------------------------------------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment