diff --git a/compiler/src/ast/parser.cpp b/compiler/src/ast/parser.cpp index de9ac3ca..855b9ed4 100644 --- a/compiler/src/ast/parser.cpp +++ b/compiler/src/ast/parser.cpp @@ -187,9 +187,6 @@ expr *parser::factor() { return ex; } expr *parser::unary() { - // TODO if it is - token and next is a number literal - // then we can convert it to a negative number literal - // and remove the unary operator if (match({token_type::SUB, token_type::KEYWORD_NOT, token_type::TILDE})) { auto opr = previous(); expr *right = unary(); @@ -1052,28 +1049,6 @@ stmt *parser::runtimefeature_statement() { "Expect new line after value for runtimefeature statement."); return pool_.c_runtimefeature_stmt(runtime_feature_kw, cc); } -curly_call_expr *parser::match_directive_options() { - auto curly_open = previous(); - std::vector values{}; - if (!check(token_type::CURLY_BRACKET_CLOSE)) { - do { - auto member_name = - consume(token_type::NAME, "Directive key must be present"); - consume(token_type::COLON, "Colon must be present between key and value"); - auto got_str = - match({token_type::STRING, token_type::THREE_QUOTE_STRING}); - if (!got_str) { - throw error(member_name, "Directive value must be a string literal"); - } - auto exp = pool_.c_literal_expr(previous()); - values.emplace_back(name_val{member_name, exp}); - } while (match({token_type::COMMA})); - } - auto curly_close = consume(token_type::CURLY_BRACKET_CLOSE, - "directive options must end with '}'"); - return dynamic_cast( - pool_.c_curly_call_expr(nullptr, curly_open, values, curly_close)); -} stmt *parser::directive_statement() { // directive name="str" name2="str" ... (name|ccode) ("STR")? (NEW_LINE|EOF) auto directive_keyword = previous(); diff --git a/compiler/src/ast/parser.h b/compiler/src/ast/parser.h index 51ba06cf..0997c4d5 100644 --- a/compiler/src/ast/parser.h +++ b/compiler/src/ast/parser.h @@ -163,7 +163,6 @@ namespace yaksha { token *sugar_else_; stmt *parse_named_let_statement(); stmt *directive_statement(); - curly_call_expr *match_directive_options(); token *consume_any_of(std::initializer_list types, const std::string &message); };