mirror of
https://github.com/TheM1Stery/izanami.git
synced 2025-05-15 00:51:16 +00:00
feat: finish challenge #1 from chapter 6
This commit is contained in:
parent
91cfc0b938
commit
4fd04e8fd3
@ -1,5 +1,3 @@
|
||||
use std::fmt::Display;
|
||||
|
||||
use crate::{
|
||||
ast::Expr,
|
||||
token::{LiteralType, Token, TokenType},
|
||||
@ -26,7 +24,13 @@ 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
|
||||
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