mirror of
https://github.com/TheM1Stery/izanami.git
synced 2025-04-19 16:31:11 +00:00
Compare commits
2 Commits
91cfc0b938
...
8338c360e0
Author | SHA1 | Date | |
---|---|---|---|
8338c360e0 | |||
4fd04e8fd3 |
@ -1,5 +1,3 @@
|
||||
use std::fmt::Display;
|
||||
|
||||
use crate::{
|
||||
ast::Expr,
|
||||
token::{LiteralType, Token, TokenType},
|
||||
@ -26,7 +24,14 @@ impl Parser<'_> {
|
||||
}
|
||||
|
||||
fn expression(&mut self) -> Result<Expr, ParseError> {
|
||||
self.equality()
|
||||
self.comma()
|
||||
}
|
||||
|
||||
// Challenge #1. We're writing comma before equality, because it has the lowest precedence
|
||||
// comma -> equality ((,) equality)* ; // expression grammar
|
||||
fn comma(&mut self) -> Result<Expr, ParseError> {
|
||||
use TokenType::*;
|
||||
self.left_association_binary(&[Comma], Parser::equality)
|
||||
}
|
||||
|
||||
fn equality(&mut self) -> Result<Expr, ParseError> {
|
||||
|
Loading…
Reference in New Issue
Block a user