From c372644c489a95301126a945cef795ebaf80a65c Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Thu, 3 Aug 2017 08:07:07 +0200 Subject: [PATCH] syntax to discard the command result --- alib2cli/src/command/HelpCommand.h | 1 + alib2cli/src/parser/Parser.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/alib2cli/src/command/HelpCommand.h b/alib2cli/src/command/HelpCommand.h index e0a47b7fcc..c71d1de495 100644 --- a/alib2cli/src/command/HelpCommand.h +++ b/alib2cli/src/command/HelpCommand.h @@ -46,6 +46,7 @@ public: std::cout << ">identifier - value to xml file (ResultImmediateFileStatement)" << std::endl; std::cout << ">:identifier - value to xml file with name from environment (ResultBindedFileStatement)" << std::endl; std::cout << ">$identifier - value to variable s (ResultVariableStatement)" << std::endl; + std::cout << "> - value is discarded" << std::endl; std::cout << " - nothing specified prints to stdout (ResultPrintStatement)" << std::endl; } else if ( m_command == "" ) { std::cout << "Simple help for the query language" << std::endl; diff --git a/alib2cli/src/parser/Parser.cpp b/alib2cli/src/parser/Parser.cpp index 556c62979a..4e308e526e 100644 --- a/alib2cli/src/parser/Parser.cpp +++ b/alib2cli/src/parser/Parser.cpp @@ -151,9 +151,11 @@ void Parser::out_redirect ( std::shared_ptr < StatementList > & list ) { std::string name = getTokenValue ( ); match ( cli::Lexer::TokenType::INTEGER, cli::Lexer::TokenType::IDENTIFIER ); list->append ( std::make_unique < ResultVariableStatement > ( std::move ( name ) ) ); - } else { + } else if ( check ( cli::Lexer::TokenType::IDENTIFIER ) ) { std::string filename = matchIdentifier ( ); list->append ( std::make_unique < ResultImmediateFileStatement > ( std::move ( filename ) ) ); + } else { + return; } } -- GitLab