aboutsummaryrefslogtreecommitdiff
path: root/boot/ast.cc
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2026-07-21 21:27:03 +0200
committerEugen Wissner <belka@caraus.de>2026-07-21 21:27:03 +0200
commit5cc2947143f2a6ebd4ef1ae4d25ab956b87de808 (patch)
tree0d4489b298da3be04ed4bce117f616468146a0f8 /boot/ast.cc
parent44d6e8a27294e5ca7300ab11900011b73d9336d4 (diff)
downloadelna-5cc2947143f2a6ebd4ef1ae4d25ab956b87de808.tar.gz
Redefine strings as slice of constant charactersHEADcpp
Diffstat (limited to 'boot/ast.cc')
-rw-r--r--boot/ast.cc38
1 files changed, 27 insertions, 11 deletions
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 "<<";