From 5cc2947143f2a6ebd4ef1ae4d25ab956b87de808 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Tue, 21 Jul 2026 21:27:03 +0200 Subject: Redefine strings as slice of constant characters --- boot/ast.cc | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) (limited to 'boot/ast.cc') diff --git a/boot/ast.cc b/boot/ast.cc index 3727aba..ec5b27d 100644 --- a/boot/ast.cc +++ b/boot/ast.cc @@ -438,8 +438,8 @@ namespace elna::boot void walking_visitor::visit(slicing_expression *expression) { expression->base().accept(this); - expression->offset().accept(this); - expression->length().accept(this); + expression->start().accept(this); + expression->end().accept(this); } void walking_visitor::visit(traits_expression *trait) @@ -1070,8 +1070,8 @@ namespace elna::boot } slicing_expression::slicing_expression(const source_position position, - expression *base, expression *offset, expression *length) - : node(position), m_base(base), m_offset(offset), m_length(length) + expression *base, expression *start, expression *end) + : node(position), m_base(base), m_start(start), m_end(end) { } @@ -1088,8 +1088,8 @@ namespace elna::boot slicing_expression::~slicing_expression() { delete m_base; - delete m_offset; - delete m_length; + delete m_start; + delete m_end; } expression& slicing_expression::base() @@ -1097,14 +1097,14 @@ namespace elna::boot return *this->m_base; } - expression& slicing_expression::offset() + expression& slicing_expression::start() { - return *this->m_offset; + return *this->m_start; } - expression& slicing_expression::length() + expression& slicing_expression::end() { - return *this->m_length; + return *this->m_end; } named_expression::named_expression(const source_position position, const std::string& name) @@ -1242,6 +1242,11 @@ namespace elna::boot return m_operator; } + void binary_expression::operation(binary_operator operation) + { + this->m_operator = operation; + } + binary_expression::~binary_expression() { delete m_lhs; @@ -1274,6 +1279,11 @@ namespace elna::boot return this->m_operator; } + void unary_expression::operation(unary_operator operation) + { + this->m_operator = operation; + } + unary_expression::~unary_expression() { delete m_operand; @@ -1540,10 +1550,16 @@ namespace elna::boot case greater_equal: return ">="; case conjunction: - return "and"; + case logical_conjunction: + case bitwise_conjunction: + return "&"; case disjunction: + case logical_disjunction: + case bitwise_disjunction: return "or"; case exclusive_disjunction: + case logical_exclusive_disjunction: + case bitwise_exclusive_disjunction: return "xor"; case shift_left: return "<<"; -- cgit v1.2.3