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

format code

parent 1b2d1ef1
No related branches found
No related tags found
No related merge requests found
...@@ -85,7 +85,7 @@ L3: character = in.get ( ); ...@@ -85,7 +85,7 @@ L3: character = in.get ( );
if ( in.eof ( ) ) { if ( in.eof ( ) ) {
token.type = TokenType::TEOF; token.type = TokenType::TEOF;
return token; return token;
} else if ( character >= 'A' && character <= 'Z' ) { } else if ( ( character >= 'A' ) && ( character <= 'Z' ) ) {
token.type = TokenType::NONLINEAR_VARIABLE; token.type = TokenType::NONLINEAR_VARIABLE;
token.value += character; token.value += character;
token.raw += character; token.raw += character;
...@@ -96,7 +96,6 @@ L3: character = in.get ( ); ...@@ -96,7 +96,6 @@ L3: character = in.get ( );
token.type = TokenType::ERROR; token.type = TokenType::ERROR;
return token; return token;
} }
} }
   
void TreeFromStringLexer::putback ( std::istream & in, TreeFromStringLexer::Token token ) const { void TreeFromStringLexer::putback ( std::istream & in, TreeFromStringLexer::Token token ) const {
......
...@@ -53,7 +53,7 @@ Tree TreeFromStringParser::parseTree ( std::istream & input, const std::set < FE ...@@ -53,7 +53,7 @@ Tree TreeFromStringParser::parseTree ( std::istream & input, const std::set < FE
token = m_TreeLexer.next ( input ); token = m_TreeLexer.next ( input );
   
if ( token.type == TreeFromStringLexer::TokenType::RANK ) { if ( token.type == TreeFromStringLexer::TokenType::RANK ) {
std::set<alphabet::RankedSymbol> nonlinearVariables; std::set < alphabet::RankedSymbol > nonlinearVariables;
   
rank = std::stou ( token.value ); rank = std::stou ( token.value );
   
...@@ -79,7 +79,7 @@ Tree TreeFromStringParser::parseTree ( std::istream & input, const std::set < FE ...@@ -79,7 +79,7 @@ Tree TreeFromStringParser::parseTree ( std::istream & input, const std::set < FE
if ( features.count ( FEATURES::RANKED_TREE ) ) return Tree ( tree ); if ( features.count ( FEATURES::RANKED_TREE ) ) return Tree ( tree );
} }
} else { } else {
std::set<alphabet::Symbol> nonlinearVariables; std::set < alphabet::Symbol > nonlinearVariables;
   
std::vector < tree::UnrankedNode * > childs; std::vector < tree::UnrankedNode * > childs;
bool isPattern = false; bool isPattern = false;
...@@ -114,7 +114,7 @@ Tree TreeFromStringParser::parseTree ( std::istream & input, const std::set < FE ...@@ -114,7 +114,7 @@ Tree TreeFromStringParser::parseTree ( std::istream & input, const std::set < FE
} }
} }
   
tree::RankedNode * TreeFromStringParser::parseRankedContent ( std::istream & input, bool & isPattern, std::set<alphabet::RankedSymbol> & nonlinearVariables ) const { tree::RankedNode * TreeFromStringParser::parseRankedContent ( std::istream & input, bool & isPattern, std::set < alphabet::RankedSymbol > & nonlinearVariables ) const {
TreeFromStringLexer::Token token = m_TreeLexer.next ( input ); TreeFromStringLexer::Token token = m_TreeLexer.next ( input );
   
if ( token.type == TreeFromStringLexer::TokenType::SUBTREE_WILDCARD ) { if ( token.type == TreeFromStringLexer::TokenType::SUBTREE_WILDCARD ) {
...@@ -124,7 +124,7 @@ tree::RankedNode * TreeFromStringParser::parseRankedContent ( std::istream & inp ...@@ -124,7 +124,7 @@ tree::RankedNode * TreeFromStringParser::parseRankedContent ( std::istream & inp
} else if ( token.type == TreeFromStringLexer::TokenType::NONLINEAR_VARIABLE ) { } else if ( token.type == TreeFromStringLexer::TokenType::NONLINEAR_VARIABLE ) {
isPattern = true; isPattern = true;
alphabet::RankedSymbol nonlinearVariable ( alphabet::Symbol ( alphabet::NonlinearVariableSymbol ( alphabet::symbolFrom ( token.value ) ) ), 0 ); alphabet::RankedSymbol nonlinearVariable ( alphabet::Symbol ( alphabet::NonlinearVariableSymbol ( alphabet::symbolFrom ( token.value ) ) ), 0 );
nonlinearVariables.insert(nonlinearVariable); nonlinearVariables.insert ( nonlinearVariable );
return new RankedNode ( std::move ( nonlinearVariable ), { } ); return new RankedNode ( std::move ( nonlinearVariable ), { } );
} else { } else {
m_TreeLexer.putback ( input, token ); m_TreeLexer.putback ( input, token );
...@@ -147,7 +147,7 @@ tree::RankedNode * TreeFromStringParser::parseRankedContent ( std::istream & inp ...@@ -147,7 +147,7 @@ tree::RankedNode * TreeFromStringParser::parseRankedContent ( std::istream & inp
} }
} }
   
tree::UnrankedNode * TreeFromStringParser::parseUnrankedContent ( std::istream & input, bool & isPattern, std::set<alphabet::Symbol>& nonlinearVariables ) const { tree::UnrankedNode * TreeFromStringParser::parseUnrankedContent ( std::istream & input, bool & isPattern, std::set < alphabet::Symbol > & nonlinearVariables ) const {
TreeFromStringLexer::Token token = m_TreeLexer.next ( input ); TreeFromStringLexer::Token token = m_TreeLexer.next ( input );
   
if ( token.type == TreeFromStringLexer::TokenType::SUBTREE_WILDCARD ) { if ( token.type == TreeFromStringLexer::TokenType::SUBTREE_WILDCARD ) {
...@@ -167,7 +167,7 @@ tree::UnrankedNode * TreeFromStringParser::parseUnrankedContent ( std::istream & ...@@ -167,7 +167,7 @@ tree::UnrankedNode * TreeFromStringParser::parseUnrankedContent ( std::istream &
   
isPattern = true; isPattern = true;
alphabet::Symbol nonlinearVariable ( alphabet::NonlinearVariableSymbol ( alphabet::symbolFrom ( token.value ) ) ); alphabet::Symbol nonlinearVariable ( alphabet::NonlinearVariableSymbol ( alphabet::symbolFrom ( token.value ) ) );
nonlinearVariables.insert(nonlinearVariable); nonlinearVariables.insert ( nonlinearVariable );
return new UnrankedNode ( std::move ( nonlinearVariable ), { } ); return new UnrankedNode ( std::move ( nonlinearVariable ), { } );
} else { } else {
m_TreeLexer.putback ( input, token ); m_TreeLexer.putback ( input, token );
......
...@@ -29,8 +29,8 @@ public: ...@@ -29,8 +29,8 @@ public:
TreeFromStringParser ( ) { } TreeFromStringParser ( ) { }
   
private: private:
tree::RankedNode * parseRankedContent ( std::istream &, bool &, std::set<alphabet::RankedSymbol> & ) const; tree::RankedNode * parseRankedContent ( std::istream &, bool &, std::set < alphabet::RankedSymbol > & ) const;
tree::UnrankedNode * parseUnrankedContent ( std::istream &, bool &, std::set<alphabet::Symbol>& ) const; tree::UnrankedNode * parseUnrankedContent ( std::istream &, bool &, std::set < alphabet::Symbol > & ) const;
   
TreeFromStringLexer m_TreeLexer; TreeFromStringLexer m_TreeLexer;
   
......
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