From 35989b69510400cc6a28190e415687a847cd5a40 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Wed, 4 Mar 2026 01:44:45 +0100 Subject: Add preliminary root node --- oryxc/src/parser.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'oryxc') diff --git a/oryxc/src/parser.rs b/oryxc/src/parser.rs index 2b42a8f..815327a 100644 --- a/oryxc/src/parser.rs +++ b/oryxc/src/parser.rs @@ -26,6 +26,7 @@ const MAX_PREC: i64 = 6; #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum AstType { Assign, /* (extra-data-lhs, extra-data-rhs) */ + BinaryOperator, /* (lhs, rhs) */ Block, /* (extra-data, extra-data-len) */ Dereference, /* (lhs, _) */ Empty, /* (_, _) */ @@ -37,9 +38,10 @@ pub enum AstType { Number, /* (_, _) */ Pointer, /* (rhs, _) */ Return, /* (extra-data, extra-data-len) */ + /* TODO: Construct this thing */ + Root, /* (extra-data, extra-data-len) */ String, /* (_, _) */ UnaryOperator, /* (rhs, _) */ - BinaryOperator, /* (lhs, rhs) */ } #[derive(Clone, Copy)] @@ -190,7 +192,10 @@ impl<'a> Parser<'a> { (node, self.node_span_1(expr).1) }, AstType::Pointer => (node, self.node_span_1(_0).1), - AstType::Block | AstType::FunCall | AstType::Return => { + AstType::Block + | AstType::FunCall + | AstType::Return + | AstType::Root => { if _1 == 0 { (node, node) } else { -- cgit v1.2.3