Skip to content
Snippets Groups Projects
Commit 44f1bb5b authored by Jan Trávníček's avatar Jan Trávníček Committed by Jan Trávníček
Browse files

clang-tidy: merge namespace specifiers

parent 3a39d6ab
No related branches found
No related tags found
1 merge request!200clang tidy fixes
Showing
with 51 additions and 131 deletions
#include "ToRTEStateElimination.h"
#include <registration/AlgoRegistration.hpp>
 
namespace automaton {
namespace {
 
namespace convert {
auto ToRTEStateEliminationDFTA = registration::AbstractRegister < automaton::convert::ToRTEStateElimination, rte::FormalRTE < ext::variant < DefaultSymbolType, DefaultStateType > >, const automaton::DFTA < > & > ( automaton::convert::ToRTEStateElimination::convert, "automaton" );
auto ToRTEStateEliminationNFTA = registration::AbstractRegister < automaton::convert::ToRTEStateElimination, rte::FormalRTE < ext::variant < DefaultSymbolType, DefaultStateType > >, const automaton::NFTA < > & > ( automaton::convert::ToRTEStateElimination::convert, "automaton" );
 
auto ToRTEStateEliminationDFTA = registration::AbstractRegister< ToRTEStateElimination, rte::FormalRTE< ext::variant< DefaultSymbolType, DefaultStateType > >, const automaton::DFTA<>& > ( ToRTEStateElimination::convert, "automaton" );
auto ToRTEStateEliminationNFTA = registration::AbstractRegister< ToRTEStateElimination, rte::FormalRTE< ext::variant< DefaultSymbolType, DefaultStateType > >, const automaton::NFTA<>& > ( ToRTEStateElimination::convert, "automaton" );
} /* namespace convert */
} /* namespace automaton */
} /* namespace */
#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 ) {
constexpr size_t ENGLISH_ALPHABET_SIZE = 26;
......@@ -46,9 +44,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 {
 
......
#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)
......@@ -64,9 +62,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 {
 
......
......@@ -14,9 +14,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 ) {
......@@ -251,9 +249,7 @@ automaton::NPDA < > automaton::transform::RHPDAToPDA::convert ( const automaton:
return res;
}
 
} /* namespace transform */
} /* namespace automaton */
} /* namespace automaton::transform */
 
namespace {
 
......
#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)
......@@ -33,9 +31,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 {
 
......
......@@ -3,9 +3,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
......@@ -205,9 +203,7 @@ void regexp::convert::ToAutomatonThompson::Unbounded::visit(const regexp::Unboun
tailArg = &(*automaton.getStates().find(tail));
}
 
} /* namespace convert */
} /* namespace regexp */
} /* namespace regexp::convert */
 
namespace {
 
......
......@@ -7,9 +7,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 )
......@@ -140,9 +138,7 @@ ext::ptr_value < regexp::UnboundedRegExpElement < SymbolType > > regexp::generat
}
}
 
} /* namespace generate */
} /* namespace regexp */
} /* namespace regexp::generate */
 
namespace {
 
......
......@@ -4,9 +4,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 );
......@@ -22,15 +20,6 @@ string::LinearString < std::string > string::generate::RandomStringFactory::gene
return string::LinearString < std::string > ( elems );
}
 
auto GenerateLinearString1 = registration::AbstractRegister < string::generate::RandomStringFactory, string::LinearString < std::string >, size_t, size_t, bool, bool > ( string::generate::RandomStringFactory::generateLinearString, abstraction::AlgorithmCategories::AlgorithmCategory::DEFAULT, "size", "alphabetSize", "randomizedAlphabet", "integerSymbols" ).setDocumentation (
"Generates a random string of given size.\n\
\n\
@param size the length of the generated string\n\
@param alphabetSize size of the alphabet (1-26 for characters and 0-INT_MAX for integers)\n\
@param randomizedAlphabet selects random symbols from a-z range if true\n\
@param integerSymbols use integers as symbols in the generated string is true, randomize alphabet is not used if integer alphabet is requested\n\
@return random string" );
string::LinearString < std::string > string::generate::RandomStringFactory::generateLinearString ( size_t size, size_t alphabetSize, bool randomizedAlphabet ) {
if ( alphabetSize > 26 )
throw exception::CommonException ( "Too big alphabet." );
......@@ -50,12 +39,19 @@ string::LinearString < std::string > string::generate::RandomStringFactory::gene
return string::generate::RandomStringFactory::generateLinearString ( size, alphabet );
}
 
} /* namespace generate */
} /* namespace string */
} /* namespace string::generate */
 
namespace {
 
auto GenerateLinearString1 = registration::AbstractRegister < string::generate::RandomStringFactory, string::LinearString < std::string >, size_t, size_t, bool, bool > ( string::generate::RandomStringFactory::generateLinearString, abstraction::AlgorithmCategories::AlgorithmCategory::DEFAULT, "size", "alphabetSize", "randomizedAlphabet", "integerSymbols" ).setDocumentation (
"Generates a random string of given size.\n\
\n\
@param size the length of the generated string\n\
@param alphabetSize size of the alphabet (1-26 for characters and 0-INT_MAX for integers)\n\
@param randomizedAlphabet selects random symbols from a-z range if true\n\
@param integerSymbols use integers as symbols in the generated string is true, randomize alphabet is not used if integer alphabet is requested\n\
@return random string" );
auto GenerateLinearString2 = registration::AbstractRegister < string::generate::RandomStringFactory, string::LinearString < std::string >, size_t, size_t, bool > ( string::generate::RandomStringFactory::generateLinearString, abstraction::AlgorithmCategories::AlgorithmCategory::DEFAULT, "size", "alphabetSize", "randomizedAlphabet" ).setDocumentation (
"Generates a random string of given size.\n\
\n\
......
......@@ -22,9 +22,7 @@
 
#include <global/GlobalData.h>
 
namespace tree {
namespace generate {
namespace tree::generate {
 
struct Node {
char symbol;
......@@ -519,9 +517,7 @@ RankedNonlinearPattern < > RandomRankedNonlinearPatternFactory::generateRankedNo
return tree;
}
 
} /* namespace generate */
} /* namespace tree */
} /* namespace tree::generate */
 
namespace {
 
......
......@@ -10,9 +10,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;
......@@ -62,9 +60,7 @@ automaton::DFA < std::string, unsigned > MinimizeGenerator::generateMinimizeDFA
throw exception::CommonException ( "Generating automaton for minimization failed." );
}
 
} /* namespace generate */
} /* namespace automaton */
} /* namespace automaton::generate */
 
namespace {
 
......
#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
......@@ -49,9 +47,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 {
 
......
#include "RandomAutomatonFactory3.h"
#include <registration/AlgoRegistration.hpp>
 
namespace automaton {
namespace generate {
namespace automaton::generate {
 
automaton::MultiInitialStateNFA < std::string, unsigned > RandomAutomatonFactory3::generate ( size_t statesMinimal, size_t statesDuplicates, size_t statesUnreachable, size_t statesUseless, size_t initialStates, size_t finalStates, size_t alphabetSize, bool randomizedAlphabet, double density, bool deterministic ) {
if ( alphabetSize > 26 )
......@@ -44,9 +42,7 @@ ext::vector < unsigned > RandomAutomatonFactory3::makeVector ( size_t begin, siz
return res;
}
 
} /* namespace generate */
} /* namespace automaton */
} /* namespace automaton::generate */
 
namespace {
 
......
......@@ -3,9 +3,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 )
......@@ -71,6 +69,4 @@ void AbsorbTerminalSymbol::absorbTerminalSymbol ( grammar::CFG < > & grammar, co
grammar = res;
}
 
} /* namespace parsing */
} /* namespace grammar */
} /* namespace grammar::parsing */
......@@ -10,9 +10,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 ) {
 
......@@ -75,6 +73,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 */
......@@ -2,9 +2,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 ) {
 
......@@ -24,6 +22,4 @@ ext::map < ext::pair < ext::vector < DefaultSymbolType >, DefaultSymbolType >, e
return res;
}
 
} /* namespace parsing */
} /* namespace grammar */
} /* namespace grammar::parsing */
......@@ -3,9 +3,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 ( ) );
......@@ -34,6 +32,4 @@ void ExtractRightContext::extractRightContext ( grammar::CFG < > & grammar, cons
grammar = res;
}
 
} /* namespace parsing */
} /* namespace grammar */
} /* namespace grammar::parsing */
......@@ -5,9 +5,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 )
......@@ -19,6 +17,4 @@ void HandleFirstFirstConflict::handleFirstFirstConflict ( grammar::CFG < > & gra
LeftFactorize::leftFactorize ( grammar, terminal, nonterminal );
}
 
} /* namespace parsing */
} /* namespace grammar */
} /* namespace grammar::parsing */
......@@ -7,9 +7,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 );
......@@ -54,6 +52,4 @@ void HandleFirstFollowConflict::handleFirstFollowConflict ( grammar::CFG < > & g
AbsorbTerminalSymbol::absorbTerminalSymbol ( grammar, terminal, symbolsEndingWithNonterminal );
}
 
} /* namespace parsing */
} /* namespace grammar */
} /* namespace grammar::parsing */
......@@ -4,9 +4,7 @@
 
#include <queue>
 
namespace grammar {
namespace parsing {
namespace grammar::parsing {
 
LR0Items LR0Parser::getClosure ( LR0Items items, const grammar::CFG < > & originalGrammar ) {
bool changed;
......@@ -101,6 +99,4 @@ automaton::DFA < ext::variant < DefaultSymbolType, DefaultSymbolType >, LR0Items
return lr0Automaton;
}
 
} /* namespace parsing */
} /* namespace grammar */
} /* namespace grammar::parsing */
......@@ -4,9 +4,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 ( ) );
......@@ -64,6 +62,4 @@ bool LRParser::parse ( const LRActionTable & actionTable, const LRGotoTable & go
return false;
}
 
} /* namespace parsing */
} /* namespace grammar */
} /* namespace grammar::parsing */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment