mirror of
https://github.com/TheM1Stery/izanami.git
synced 2025-04-20 08:51:12 +00:00
Compare commits
No commits in common. "8338c360e042569476ccc455169b9f686bb22f42" and "91cfc0b938bc31ef7ed38e9a797669cd2ac83a83" have entirely different histories.
8338c360e0
...
91cfc0b938
@ -1,3 +1,5 @@
|
|||||||
|
use std::fmt::Display;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
ast::Expr,
|
ast::Expr,
|
||||||
token::{LiteralType, Token, TokenType},
|
token::{LiteralType, Token, TokenType},
|
||||||
@ -24,14 +26,7 @@ impl Parser<'_> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn expression(&mut self) -> Result<Expr, ParseError> {
|
fn expression(&mut self) -> Result<Expr, ParseError> {
|
||||||
self.comma()
|
self.equality()
|
||||||
}
|
|
||||||
|
|
||||||
// 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> {
|
fn equality(&mut self) -> Result<Expr, ParseError> {
|
||||||
|
Loading…
Reference in New Issue
Block a user