diff --git a/alib2cli/src/lexer/Lexer.cpp b/alib2cli/src/lexer/Lexer.cpp index 9aae8582129fb3254114119ec09f9d9e8e3230c0..e1cfab9a78c4fc363699323a7403d32ae8ca50cc 100644 --- a/alib2cli/src/lexer/Lexer.cpp +++ b/alib2cli/src/lexer/Lexer.cpp @@ -32,13 +32,13 @@ q0: if ( m_source.getCharacter ( ) == EOF ) { if ( m_source.getCharacter ( ) == '<' ) { res.m_raw += m_source.getCharacter ( ); m_source.advance ( readNextLine ); - res.m_type = TokenType::LESS_SIGN; + res.m_type = TokenType::LESS_THAN; goto q10; } if ( m_source.getCharacter ( ) == '>' ) { res.m_raw += m_source.getCharacter ( ); m_source.advance ( readNextLine ); - res.m_type = TokenType::MORE_SIGN; + res.m_type = TokenType::MORE_THAN; goto q11; } if ( m_source.getCharacter ( ) == '(' ) { @@ -86,7 +86,7 @@ q0: if ( m_source.getCharacter ( ) == EOF ) { if ( m_source.getCharacter ( ) == '$' ) { res.m_raw += m_source.getCharacter ( ); m_source.advance ( readNextLine ); - res.m_type = TokenType::DOLAR_SIGN; + res.m_type = TokenType::DOLLAR_SIGN; return res; } if ( m_source.getCharacter ( ) == '&' ) { @@ -122,7 +122,7 @@ q0: if ( m_source.getCharacter ( ) == EOF ) { if ( m_source.getCharacter ( ) == '=' ) { res.m_raw += m_source.getCharacter ( ); m_source.advance ( readNextLine ); - res.m_type = TokenType::ASSIGN_OPERATOR; + res.m_type = TokenType::ASSIGN; goto q12; } if ( m_source.getCharacter ( ) == '#' ) { @@ -158,13 +158,13 @@ q0: if ( m_source.getCharacter ( ) == EOF ) { if ( m_source.getCharacter ( ) == '*' ) { res.m_raw += m_source.getCharacter ( ); m_source.advance ( readNextLine ); - res.m_type = TokenType::STAR_SIGN; + res.m_type = TokenType::ASTERISK_SIGN; return res; } if ( m_source.getCharacter ( ) == '~' ) { res.m_raw += m_source.getCharacter ( ); m_source.advance ( readNextLine ); - res.m_type = TokenType::TYLDE_SIGN; + res.m_type = TokenType::TILDE_SIGN; return res; } if ( m_source.getCharacter ( ) == '!' ) { @@ -263,7 +263,7 @@ q2: q2Prime: if ( m_source.getCharacter ( ) == '\0' ) { res.m_value = ""; - res.m_type = TokenType::DEC_OPERATOR; + res.m_type = TokenType::DEC; return res; } if ( ( m_source.getCharacter ( ) >= '0' && m_source.getCharacter ( ) <= '9' ) @@ -281,7 +281,7 @@ q2Prime: } res.m_value = ""; - res.m_type = TokenType::DEC_OPERATOR; + res.m_type = TokenType::DEC; return res; q3: if ( m_source.getCharacter ( ) == '\0' ) { @@ -383,7 +383,7 @@ q7: if ( m_source.getCharacter ( ) == EOF ) { if ( m_source.getCharacter ( ) == '+' ) { res.m_raw += m_source.getCharacter ( ); m_source.advance ( readNextLine ); - res.m_type = TokenType::INC_OPERATOR; + res.m_type = TokenType::INC; } else { return res; } @@ -397,7 +397,7 @@ q8: if ( m_source.getCharacter ( ) == EOF ) { if ( m_source.getCharacter ( ) == '&' ) { res.m_raw += m_source.getCharacter ( ); m_source.advance ( readNextLine ); - res.m_type = TokenType::AND_OPERATOR; + res.m_type = TokenType::AND; } else { return res; } @@ -411,7 +411,7 @@ q9: if ( m_source.getCharacter ( ) == EOF ) { if ( m_source.getCharacter ( ) == '|' ) { res.m_raw += m_source.getCharacter ( ); m_source.advance ( readNextLine ); - res.m_type = TokenType::OR_OPERATOR; + res.m_type = TokenType::OR; } else { return res; } @@ -426,7 +426,7 @@ q10: if ( m_source.getCharacter ( ) == '=' ) { res.m_raw += m_source.getCharacter ( ); m_source.advance ( readNextLine ); - res.m_type = TokenType::LESS_OR_EQUAL_OPERATOR; + res.m_type = TokenType::LESS_THAN_OR_EQUAL; } else { return res; } @@ -441,7 +441,7 @@ q11: if ( m_source.getCharacter ( ) == '=' ) { res.m_raw += m_source.getCharacter ( ); m_source.advance ( readNextLine ); - res.m_type = TokenType::MORE_OR_EQUAL_OPERATOR; + res.m_type = TokenType::MORE_THAN_OR_EQUAL; } else { return res; } @@ -456,7 +456,7 @@ q12: if ( m_source.getCharacter ( ) == '=' ) { res.m_raw += m_source.getCharacter ( ); m_source.advance ( readNextLine ); - res.m_type = TokenType::EQUAL_OPERATOR; + res.m_type = TokenType::EQUAL; } else { return res; } @@ -471,7 +471,7 @@ q13: if ( m_source.getCharacter ( ) == '=' ) { res.m_raw += m_source.getCharacter ( ); m_source.advance ( readNextLine ); - res.m_type = TokenType::NOT_EQUAL_OPERATOR; + res.m_type = TokenType::NOT_EQUAL; } else { return res; } diff --git a/alib2cli/src/lexer/Lexer.h b/alib2cli/src/lexer/Lexer.h index 76931865194d251f3fe14249385435cf8fc1b470..3618ec6e0c7b4814fbb9e3f7ac4269e1d05cb0c0 100644 --- a/alib2cli/src/lexer/Lexer.h +++ b/alib2cli/src/lexer/Lexer.h @@ -30,40 +30,46 @@ public: IDENTIFIER, UNSIGNED, STRING, - LESS_SIGN, - LESS_OR_EQUAL_OPERATOR, - MORE_SIGN, - MORE_OR_EQUAL_OPERATOR, + + LESS_THAN, + LESS_THAN_OR_EQUAL, + MORE_THAN, + MORE_THAN_OR_EQUAL, + EQUAL, + NOT_EQUAL, + LEFT_PAREN, RIGHT_PAREN, LEFT_BRACE, RIGHT_BRACE, LEFT_BRACKET, RIGHT_BRACKET, - DOLAR_SIGN, + + DOLLAR_SIGN, AT_SIGN, AMPERSAND_SIGN, - AND_OPERATOR, PIPE_SIGN, - OR_OPERATOR, CARET_SIGN, COLON_SIGN, SEMICOLON_SIGN, MINUS_SIGN, - DEC_OPERATOR, PLUS_SIGN, - INC_OPERATOR, SLASH_SIGN, - STAR_SIGN, - TYLDE_SIGN, + ASTERISK_SIGN, + TILDE_SIGN, EXCLAMATION_SIGN, PERCENTAGE_SIGN, - ASSIGN_OPERATOR, - EQUAL_OPERATOR, - NOT_EQUAL_OPERATOR, HASH_SIGN, + + AND, + OR, + DEC, + INC, + ASSIGN, + COMMA, DOT, + FILE, TYPE, ERROR, @@ -83,14 +89,20 @@ public: return "unsigned"; case TokenType::STRING : return "string"; - case TokenType::LESS_SIGN : - return "less_sign"; - case TokenType::LESS_OR_EQUAL_OPERATOR : - return "less_or_equal_operator"; - case TokenType::MORE_SIGN : - return "more_sign"; - case TokenType::MORE_OR_EQUAL_OPERATOR : + + case TokenType::LESS_THAN : + return "less_than"; + case TokenType::LESS_THAN_OR_EQUAL : + return "less_than_or_equal"; + case TokenType::MORE_THAN : + return "more_than"; + case TokenType::MORE_THAN_OR_EQUAL : return "more_or_equal_operator"; + case TokenType::EQUAL : + return "equal"; + case TokenType::NOT_EQUAL : + return "not_equal"; + case TokenType::LEFT_PAREN : return "left_paren"; case TokenType::RIGHT_PAREN : @@ -103,18 +115,15 @@ public: return "left_bracket"; case TokenType::RIGHT_BRACKET : return "right_bracket"; + + case TokenType::DOLLAR_SIGN : + return "dolar_sign"; case TokenType::AT_SIGN : return "at_sign"; - case TokenType::DOLAR_SIGN : - return "dolar_sign"; case TokenType::AMPERSAND_SIGN : return "ampersand_sign"; - case TokenType::AND_OPERATOR : - return "and_operator"; case TokenType::PIPE_SIGN : return "pipe_sign"; - case TokenType::OR_OPERATOR : - return "or_operator"; case TokenType::CARET_SIGN : return "caret_sign"; case TokenType::COLON_SIGN : @@ -123,34 +132,37 @@ public: return "semicolon_sign"; case TokenType::MINUS_SIGN : return "minus_sign"; - case TokenType::DEC_OPERATOR : - return "dec_operator"; case TokenType::PLUS_SIGN : return "plus_sign"; - case TokenType::INC_OPERATOR : - return "inc_operator"; case TokenType::SLASH_SIGN : return "slash_sign"; - case TokenType::STAR_SIGN : - return "star_sign"; - case TokenType::TYLDE_SIGN : - return "tylde_sign"; + case TokenType::ASTERISK_SIGN : + return "asterisk_sign"; + case TokenType::TILDE_SIGN : + return "tilde_sign"; case TokenType::EXCLAMATION_SIGN : return "exclemation_sign"; case TokenType::PERCENTAGE_SIGN : return "percentage_sign"; - case TokenType::ASSIGN_OPERATOR : - return "assign_operator"; - case TokenType::EQUAL_OPERATOR : - return "equal_operator"; - case TokenType::NOT_EQUAL_OPERATOR : - return "not_equal_operator"; case TokenType::HASH_SIGN : return "hash_sign"; + + case TokenType::AND: + return "and"; + case TokenType::OR: + return "or"; + case TokenType::DEC: + return "dec"; + case TokenType::INC: + return "inc"; + case TokenType::ASSIGN: + return "assign"; + case TokenType::COMMA : return "comma"; case TokenType::DOT : return "dot"; + case TokenType::FILE : return "file"; case TokenType::TYPE : diff --git a/alib2cli/src/parser/Parser.cpp b/alib2cli/src/parser/Parser.cpp index ce6814729cf2963650a5afd0708299b2be66d6ea..03c3178acd9d02efe0a5460de22fd2d78970ee11 100644 --- a/alib2cli/src/parser/Parser.cpp +++ b/alib2cli/src/parser/Parser.cpp @@ -133,8 +133,8 @@ std::unique_ptr < Arg > Parser::template_arg ( ) { } std::unique_ptr < Arg > Parser::optional_variable ( ) { - if ( check ( cli::Lexer::TokenType::DOLAR_SIGN ) ) { - match ( cli::Lexer::TokenType::DOLAR_SIGN ); + if ( check ( cli::Lexer::TokenType::DOLLAR_SIGN ) ) { + match ( cli::Lexer::TokenType::DOLLAR_SIGN ); std::string value = getTokenValue ( ); match ( cli::Lexer::TokenType::UNSIGNED, cli::Lexer::TokenType::IDENTIFIER ); return std::make_unique < ImmediateArg > ( value ); @@ -180,8 +180,8 @@ std::shared_ptr < Statement > Parser::in_redirect ( ) { } std::unique_ptr < Statement > Parser::out_redirect ( ) { - if ( check ( cli::Lexer::TokenType::DOLAR_SIGN ) ) { - match ( cli::Lexer::TokenType::DOLAR_SIGN ); + if ( check ( cli::Lexer::TokenType::DOLLAR_SIGN ) ) { + match ( cli::Lexer::TokenType::DOLLAR_SIGN ); std::unique_ptr < Arg > name = arg ( ); return std::make_unique < ResultVariableStatement > ( std::move ( name ) ); } else { @@ -199,12 +199,12 @@ std::unique_ptr < Statement > Parser::out_redirect ( ) { std::shared_ptr < Statement > Parser::common ( ) { clearCheckOptions ( ); - if ( check ( cli::Lexer::TokenType::DOLAR_SIGN ) ) { - match ( cli::Lexer::TokenType::DOLAR_SIGN ); + if ( check ( cli::Lexer::TokenType::DOLLAR_SIGN ) ) { + match ( cli::Lexer::TokenType::DOLLAR_SIGN ); std::unique_ptr < Arg > name = arg ( ); return std::make_shared < VariableStatement > ( std::move ( name ) ); - } else if ( check ( cli::Lexer::TokenType::LESS_SIGN ) ) { - match ( cli::Lexer::TokenType::LESS_SIGN ); + } else if ( check ( cli::Lexer::TokenType::LESS_THAN ) ) { + match ( cli::Lexer::TokenType::LESS_THAN ); return in_redirect ( ); } else if ( check ( cli::Lexer::TokenType::STRING ) ) { std::string value = matchString ( ); @@ -236,7 +236,7 @@ std::shared_ptr < Statement > Parser::common ( ) { std::shared_ptr < Statement > Parser::param ( ) { clearCheckOptions ( ); - if ( check ( cli::Lexer::TokenType::DOLAR_SIGN, cli::Lexer::TokenType::LESS_SIGN, cli::Lexer::TokenType::STRING, cli::Lexer::TokenType::UNSIGNED, cli::Lexer::TokenType::HASH_SIGN, cli::Lexer::TokenType::LEFT_BRACE ) ) { + if ( check ( cli::Lexer::TokenType::DOLLAR_SIGN, cli::Lexer::TokenType::LESS_THAN, cli::Lexer::TokenType::STRING, cli::Lexer::TokenType::UNSIGNED, cli::Lexer::TokenType::HASH_SIGN, cli::Lexer::TokenType::LEFT_BRACE ) ) { return common ( ); } else if ( check ( cli::Lexer::TokenType::MINUS_SIGN ) ) { match ( cli::Lexer::TokenType::MINUS_SIGN ); @@ -257,7 +257,7 @@ std::shared_ptr < Statement > Parser::param ( ) { std::shared_ptr < Statement > Parser::statement ( ) { clearCheckOptions ( ); - if ( check ( cli::Lexer::TokenType::DOLAR_SIGN, cli::Lexer::TokenType::LESS_SIGN, cli::Lexer::TokenType::STRING, cli::Lexer::TokenType::UNSIGNED, cli::Lexer::TokenType::HASH_SIGN, cli::Lexer::TokenType::LEFT_BRACE ) ) { + if ( check ( cli::Lexer::TokenType::DOLLAR_SIGN, cli::Lexer::TokenType::LESS_THAN, cli::Lexer::TokenType::STRING, cli::Lexer::TokenType::UNSIGNED, cli::Lexer::TokenType::HASH_SIGN, cli::Lexer::TokenType::LEFT_BRACE ) ) { return common ( ); } else if ( check ( cli::Lexer::TokenType::IDENTIFIER ) ) { std::unique_ptr < Arg > name = std::make_unique < ImmediateArg > ( matchIdentifier ( ) ); @@ -268,7 +268,7 @@ std::shared_ptr < Statement > Parser::statement ( ) { std::unique_ptr < CategoryOption > category = category_option ( ); ext::vector < std::shared_ptr < Statement > > params; - while ( ! check ( cli::Lexer::TokenType::MORE_SIGN, cli::Lexer::TokenType::PIPE_SIGN, cli::Lexer::TokenType::EOS, cli::Lexer::TokenType::EOT, cli::Lexer::TokenType::RIGHT_PAREN, cli::Lexer::TokenType::SEMICOLON_SIGN ) ) { + while ( ! check ( cli::Lexer::TokenType::MORE_THAN, cli::Lexer::TokenType::PIPE_SIGN, cli::Lexer::TokenType::EOS, cli::Lexer::TokenType::EOT, cli::Lexer::TokenType::RIGHT_PAREN, cli::Lexer::TokenType::SEMICOLON_SIGN ) ) { params.emplace_back ( param ( ) ); } @@ -287,12 +287,12 @@ std::shared_ptr < Statement > Parser::statement ( ) { std::shared_ptr < StatementList > Parser::statement_list ( ) { ext::vector < std::shared_ptr < Statement > > list; list.emplace_back ( statement ( ) ); - while ( check ( cli::Lexer::TokenType::PIPE_SIGN, cli::Lexer::TokenType::MORE_SIGN ) ) { + while ( check ( cli::Lexer::TokenType::PIPE_SIGN, cli::Lexer::TokenType::MORE_THAN ) ) { if ( check ( cli::Lexer::TokenType::PIPE_SIGN ) ) { match ( cli::Lexer::TokenType::PIPE_SIGN ); list.emplace_back ( statement ( ) ); } else { - match ( cli::Lexer::TokenType::MORE_SIGN ); + match ( cli::Lexer::TokenType::MORE_THAN ); list.emplace_back ( out_redirect ( ) ); } } @@ -423,8 +423,8 @@ std::pair < abstraction::TypeQualifiers::TypeQualifierSet, std::unique_ptr < Arg std::unique_ptr < Arg > type = arg ( ); - if ( check ( cli::Lexer::TokenType::AND_OPERATOR ) ) { - match ( cli::Lexer::TokenType::AND_OPERATOR ); + if ( check ( cli::Lexer::TokenType::AND ) ) { + match ( cli::Lexer::TokenType::AND ); typeQualifiers = typeQualifiers | abstraction::TypeQualifiers::TypeQualifierSet::RREF; } else if ( check ( cli::Lexer::TokenType::AMPERSAND_SIGN ) ) { match ( cli::Lexer::TokenType::AMPERSAND_SIGN ); @@ -437,7 +437,7 @@ std::pair < abstraction::TypeQualifiers::TypeQualifierSet, std::unique_ptr < Arg std::pair < abstraction::TypeQualifiers::TypeQualifierSet, std::unique_ptr < Arg > > Parser::runnableParam ( ) { std::pair < abstraction::TypeQualifiers::TypeQualifierSet, std::unique_ptr < Arg > > qualType = qualifiedType ( ); - match ( cli::Lexer::TokenType::DOLAR_SIGN ); + match ( cli::Lexer::TokenType::DOLLAR_SIGN ); std::unique_ptr < Arg > name = arg ( ); return std::make_pair ( qualType.first, std::move ( name ) ); @@ -573,10 +573,10 @@ std::unique_ptr < Command > Parser::command ( ) { std::pair < abstraction::TypeQualifiers::TypeQualifierSet, std::unique_ptr < Arg > > qualType = qualifiedType ( ); - match ( cli::Lexer::TokenType::DOLAR_SIGN ); + match ( cli::Lexer::TokenType::DOLLAR_SIGN ); std::unique_ptr < Arg > name = arg ( ); - match ( cli::Lexer::TokenType::ASSIGN_OPERATOR ); + match ( cli::Lexer::TokenType::ASSIGN ); std::unique_ptr < Expression > expr = expression ( ); @@ -655,11 +655,11 @@ std::unique_ptr < CommandList > Parser::parse ( ) { std::unique_ptr < Expression > Parser::assign_expression ( ) { std::unique_ptr < Expression > res = or_expression ( ); - if ( check ( cli::Lexer::TokenType::ASSIGN_OPERATOR ) ) { + if ( check ( cli::Lexer::TokenType::ASSIGN ) ) { auto checkOptions = getCheckOptions ( ); clearCheckOptions ( ); - match ( cli::Lexer::TokenType::ASSIGN_OPERATOR ); + match ( cli::Lexer::TokenType::ASSIGN ); res = std::make_unique < BinaryExpression > ( abstraction::Operators::BinaryOperators::ASSIGN, std::move ( res ), assign_expression ( ) ); @@ -670,11 +670,11 @@ std::unique_ptr < Expression > Parser::assign_expression ( ) { std::unique_ptr < Expression > Parser::or_expression ( ) { std::unique_ptr < Expression > res = and_expression ( ); - while ( check ( cli::Lexer::TokenType::OR_OPERATOR ) ) { + while ( check ( cli::Lexer::TokenType::OR ) ) { auto checkOptions = getCheckOptions ( ); clearCheckOptions ( ); - match ( cli::Lexer::TokenType::OR_OPERATOR ); + match ( cli::Lexer::TokenType::OR ); res = std::make_unique < BinaryExpression > ( abstraction::Operators::BinaryOperators::LOGICAL_OR, std::move ( res ), and_expression ( ) ); @@ -685,11 +685,11 @@ std::unique_ptr < Expression > Parser::or_expression ( ) { std::unique_ptr < Expression > Parser::and_expression ( ) { std::unique_ptr < Expression > res = bitwise_or_expression ( ); - while ( check ( cli::Lexer::TokenType::AND_OPERATOR ) ) { + while ( check ( cli::Lexer::TokenType::AND ) ) { auto checkOptions = getCheckOptions ( ); clearCheckOptions ( ); - match ( cli::Lexer::TokenType::AND_OPERATOR ); + match ( cli::Lexer::TokenType::AND ); res = std::make_unique < BinaryExpression > ( abstraction::Operators::BinaryOperators::LOGICAL_AND, std::move ( res ), bitwise_or_expression ( ) ); @@ -747,11 +747,11 @@ std::unique_ptr < Expression > Parser::equality_expression ( ) { std::unique_ptr < Expression > res = relational_expression ( ); auto checkOptions = getCheckOptions ( ); clearCheckOptions ( ); - if ( check ( cli::Lexer::TokenType::EQUAL_OPERATOR ) ) { - match ( cli::Lexer::TokenType::EQUAL_OPERATOR ); + if ( check ( cli::Lexer::TokenType::EQUAL ) ) { + match ( cli::Lexer::TokenType::EQUAL ); res = std::make_unique < BinaryExpression > ( abstraction::Operators::BinaryOperators::EQUALS, std::move ( res ), relational_expression ( ) ); - } else if ( check ( cli::Lexer::TokenType::NOT_EQUAL_OPERATOR ) ) { - match ( cli::Lexer::TokenType::NOT_EQUAL_OPERATOR ); + } else if ( check ( cli::Lexer::TokenType::NOT_EQUAL ) ) { + match ( cli::Lexer::TokenType::NOT_EQUAL ); res = std::make_unique < BinaryExpression > ( abstraction::Operators::BinaryOperators::NOT_EQUALS, std::move ( res ), relational_expression ( ) ); } restoreCheckOptions ( checkOptions ); @@ -762,17 +762,17 @@ std::unique_ptr < Expression > Parser::relational_expression ( ) { std::unique_ptr < Expression > res = add_expression ( ); auto checkOptions = getCheckOptions ( ); clearCheckOptions ( ); - if ( check ( cli::Lexer::TokenType::LESS_SIGN ) ) { - match ( cli::Lexer::TokenType::LESS_SIGN ); + if ( check ( cli::Lexer::TokenType::LESS_THAN ) ) { + match ( cli::Lexer::TokenType::LESS_THAN ); res = std::make_unique < BinaryExpression > ( abstraction::Operators::BinaryOperators::LESS, std::move ( res ), add_expression ( ) ); - } else if ( check ( cli::Lexer::TokenType::LESS_OR_EQUAL_OPERATOR ) ) { - match ( cli::Lexer::TokenType::LESS_OR_EQUAL_OPERATOR ); + } else if ( check ( cli::Lexer::TokenType::LESS_THAN_OR_EQUAL ) ) { + match ( cli::Lexer::TokenType::LESS_THAN_OR_EQUAL ); res = std::make_unique < BinaryExpression > ( abstraction::Operators::BinaryOperators::LESS_OR_EQUAL, std::move ( res ), add_expression ( ) ); - } else if ( check ( cli::Lexer::TokenType::MORE_SIGN ) ) { - match ( cli::Lexer::TokenType::MORE_SIGN ); + } else if ( check ( cli::Lexer::TokenType::MORE_THAN ) ) { + match ( cli::Lexer::TokenType::MORE_THAN ); res = std::make_unique < BinaryExpression > ( abstraction::Operators::BinaryOperators::MORE, std::move ( res ), add_expression ( ) ); - } else if ( check ( cli::Lexer::TokenType::MORE_OR_EQUAL_OPERATOR ) ) { - match ( cli::Lexer::TokenType::MORE_OR_EQUAL_OPERATOR ); + } else if ( check ( cli::Lexer::TokenType::MORE_THAN_OR_EQUAL ) ) { + match ( cli::Lexer::TokenType::MORE_THAN_OR_EQUAL ); res = std::make_unique < BinaryExpression > ( abstraction::Operators::BinaryOperators::MORE_OR_EQUAL, std::move ( res ), add_expression ( ) ); } restoreCheckOptions ( checkOptions ); @@ -798,11 +798,11 @@ std::unique_ptr < Expression > Parser::add_expression ( ) { std::unique_ptr < Expression > Parser::mul_expression ( ) { std::unique_ptr < Expression > res = prefix_expression ( ); - while ( check ( cli::Lexer::TokenType::STAR_SIGN, cli::Lexer::TokenType::PERCENTAGE_SIGN, cli::Lexer::TokenType::SLASH_SIGN ) ) { + while ( check ( cli::Lexer::TokenType::ASTERISK_SIGN, cli::Lexer::TokenType::PERCENTAGE_SIGN, cli::Lexer::TokenType::SLASH_SIGN ) ) { auto checkOptions = getCheckOptions ( ); clearCheckOptions ( ); - if ( check ( cli::Lexer::TokenType::STAR_SIGN ) ) { - match ( cli::Lexer::TokenType::STAR_SIGN ); + if ( check ( cli::Lexer::TokenType::ASTERISK_SIGN ) ) { + match ( cli::Lexer::TokenType::ASTERISK_SIGN ); res = std::make_unique < BinaryExpression > ( abstraction::Operators::BinaryOperators::MUL, std::move ( res ), prefix_expression ( ) ); } else if ( check ( cli::Lexer::TokenType::PERCENTAGE_SIGN ) ) { match ( cli::Lexer::TokenType::PERCENTAGE_SIGN ); @@ -837,16 +837,16 @@ std::unique_ptr < Expression > Parser::prefix_expression ( ) { match ( cli::Lexer::TokenType::EXCLAMATION_SIGN ); std::unique_ptr < Expression > expression = prefix_expression ( ); return std::make_unique < PrefixExpression > ( abstraction::Operators::PrefixOperators::LOGICAL_NOT, std::move ( expression ) ); - } else if ( check ( cli::Lexer::TokenType::TYLDE_SIGN ) ) { - match ( cli::Lexer::TokenType::TYLDE_SIGN ); + } else if ( check ( cli::Lexer::TokenType::TILDE_SIGN ) ) { + match ( cli::Lexer::TokenType::TILDE_SIGN ); std::unique_ptr < Expression > expression = prefix_expression ( ); return std::make_unique < PrefixExpression > ( abstraction::Operators::PrefixOperators::BINARY_NEG, std::move ( expression ) ); - } else if ( check ( cli::Lexer::TokenType::INC_OPERATOR ) ) { - match ( cli::Lexer::TokenType::INC_OPERATOR ); + } else if ( check ( cli::Lexer::TokenType::INC ) ) { + match ( cli::Lexer::TokenType::INC ); std::unique_ptr < Expression > expression = prefix_expression ( ); return std::make_unique < PrefixExpression > ( abstraction::Operators::PrefixOperators::INCREMENT, std::move ( expression ) ); - } else if ( check ( cli::Lexer::TokenType::DEC_OPERATOR ) ) { - match ( cli::Lexer::TokenType::DEC_OPERATOR ); + } else if ( check ( cli::Lexer::TokenType::DEC ) ) { + match ( cli::Lexer::TokenType::DEC ); std::unique_ptr < Expression > expression = prefix_expression ( ); return std::make_unique < PrefixExpression > ( abstraction::Operators::PrefixOperators::DECREMENT, std::move ( expression ) ); } else { @@ -857,7 +857,7 @@ std::unique_ptr < Expression > Parser::prefix_expression ( ) { std::unique_ptr < Expression > Parser::suffix_expression ( ) { std::unique_ptr < Expression > res = atom ( ); clearCheckOptions ( ); - while ( check ( cli::Lexer::TokenType::DOT, cli::Lexer::TokenType::INC_OPERATOR, cli::Lexer::TokenType::DEC_OPERATOR ) ) { + while ( check ( cli::Lexer::TokenType::DOT, cli::Lexer::TokenType::INC, cli::Lexer::TokenType::DEC ) ) { auto checkOptions = getCheckOptions ( ); clearCheckOptions ( ); if ( check ( cli::Lexer::TokenType::DOT ) ) { @@ -866,11 +866,11 @@ std::unique_ptr < Expression > Parser::suffix_expression ( ) { match ( cli::Lexer::TokenType::IDENTIFIER ); std::vector < std::unique_ptr < Expression > > params = bracketed_expression_list ( ); res = std::make_unique < MethodCallExpression > ( std::move ( res ), std::move ( memberName ), std::move ( params ) ); - } else if ( check ( cli::Lexer::TokenType::INC_OPERATOR ) ){ - match ( cli::Lexer::TokenType::INC_OPERATOR ); + } else if ( check ( cli::Lexer::TokenType::INC ) ){ + match ( cli::Lexer::TokenType::INC ); res = std::make_unique < PostfixExpression > ( abstraction::Operators::PostfixOperators::INCREMENT, std::move ( res ) ); - } else if ( check ( cli::Lexer::TokenType::DEC_OPERATOR ) ){ - match ( cli::Lexer::TokenType::DEC_OPERATOR ); + } else if ( check ( cli::Lexer::TokenType::DEC ) ){ + match ( cli::Lexer::TokenType::DEC ); res = std::make_unique < PostfixExpression > ( abstraction::Operators::PostfixOperators::DECREMENT, std::move ( res ) ); } else { throw exception::CommonException ( "Mismatched set " + ext::to_string ( getCheckOptions ( ) ) + " while expanding suffix_expression rule. Token is " + ( ( std::string ) m_current ) + "." ); @@ -892,8 +892,8 @@ std::unique_ptr < Expression > Parser::atom ( ) { match ( cli::Lexer::TokenType::IDENTIFIER ); std::vector < std::unique_ptr < Expression > > params = bracketed_expression_list ( ); return std::make_unique < FunctionCallExpression > ( routineName, std::move ( params ) ); - } else if ( check ( cli::Lexer::TokenType::DOLAR_SIGN ) ) { - match ( cli::Lexer::TokenType::DOLAR_SIGN ); + } else if ( check ( cli::Lexer::TokenType::DOLLAR_SIGN ) ) { + match ( cli::Lexer::TokenType::DOLLAR_SIGN ); std::unique_ptr < Arg > name = arg ( ); return std::make_unique < VariableExpression > ( std::move ( name ) ); } else if ( check ( cli::Lexer::TokenType::LEFT_PAREN ) ) {