kill me please

This commit is contained in:
bronku 2025-12-02 12:52:59 +01:00
parent 16f1174e7d
commit c910178efd
2 changed files with 3 additions and 2 deletions

View file

@ -180,7 +180,7 @@ private:
} }
else if (auto *str = dynamic_cast<const String *>(&expr)) else if (auto *str = dynamic_cast<const String *>(&expr))
{ {
write("\"" + str->value + "\""); write(str->value);
} }
else if (auto *binop = dynamic_cast<const BinOp *>(&expr)) else if (auto *binop = dynamic_cast<const BinOp *>(&expr))
{ {
@ -202,7 +202,7 @@ private:
} }
else if (auto *unary_op = dynamic_cast<const UnaryOpExpr *>(&expr)) else if (auto *unary_op = dynamic_cast<const UnaryOpExpr *>(&expr))
{ {
output << unary_op->op.symbol(); output << unary_op->op.symbol() << " ";
generate_expr(*unary_op->operand); generate_expr(*unary_op->operand);
} }
else if (auto *attr = dynamic_cast<const Attribute *>(&expr)) else if (auto *attr = dynamic_cast<const Attribute *>(&expr))

View file

@ -124,6 +124,7 @@ expr:
| expr LT expr { $$ = std::make_unique<BinOp>( BinaryOperator(BinaryOperator::LT) , std::move($1), std::move($3)); } | expr LT expr { $$ = std::make_unique<BinOp>( BinaryOperator(BinaryOperator::LT) , std::move($1), std::move($3)); }
| expr KW_AND expr { $$ = std::make_unique<BinOp>( BinaryOperator(BinaryOperator::AND) , std::move($1), std::move($3)); } | expr KW_AND expr { $$ = std::make_unique<BinOp>( BinaryOperator(BinaryOperator::AND) , std::move($1), std::move($3)); }
| expr KW_OR expr { $$ = std::make_unique<BinOp>( BinaryOperator(BinaryOperator::OR) , std::move($1), std::move($3)); } | expr KW_OR expr { $$ = std::make_unique<BinOp>( BinaryOperator(BinaryOperator::OR) , std::move($1), std::move($3)); }
| KW_NOT expr { $$ = std::make_unique<UnaryOpExpr>( UnaryOperator(UnaryOperator::NOT) , std::move($2)); }
| expr L_BRACKET expr R_BRACKET { $$ = std::make_unique<Subscript>(std::move($1), std::move($3));} | expr L_BRACKET expr R_BRACKET { $$ = std::make_unique<Subscript>(std::move($1), std::move($3));}
| expr L_BRACKET slice R_BRACKET{ $$ = std::make_unique<SliceSubscript>(std::move($1), std::move($3)); } | expr L_BRACKET slice R_BRACKET{ $$ = std::make_unique<SliceSubscript>(std::move($1), std::move($3)); }
| L_PAREN expr R_PAREN {$$ = std::move($2); } | L_PAREN expr R_PAREN {$$ = std::move($2); }