Make ref and deref only parse primary expression

This commit is contained in:
Sofia 2026-04-14 00:28:12 +03:00
parent d3a4964f10
commit be2d809986
2 changed files with 3 additions and 3 deletions

View File

@ -122,7 +122,7 @@ namespace parsing {
}
else if (inner.peek().content == "&") {
inner.next();
auto expr = parse_expression(inner).unwrap();
auto expr = parse_primary_expression(inner).unwrap();
stream.m_position = inner.m_position;
return std::unique_ptr<AST::Expression> {
new AST::RefExpression(before_meta + inner.metadata(), std::move(expr))
@ -130,7 +130,7 @@ namespace parsing {
}
else if (inner.peek().content == "*") {
inner.next();
auto expr = parse_expression(inner).unwrap();
auto expr = parse_primary_expression(inner).unwrap();
stream.m_position = inner.m_position;
return std::unique_ptr<AST::Expression> {
new AST::DerefExpression(before_meta + inner.metadata(), std::move(expr))

2
test.c
View File

@ -7,7 +7,7 @@ int fibonacci(int n) {
}
void modifyvalue(char* otus) {
(*otus) = 20;
*otus = 20;
}
int main() {