mirror of
https://github.com/Kindelia/Kind2.git
synced 2024-09-11 15:26:49 +03:00
fix: open statement and ;
This commit is contained in:
parent
554f1fc5d9
commit
3304d80d66
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "kind2"
|
||||
version = "0.3.6"
|
||||
version = "0.3.7"
|
||||
edition = "2021"
|
||||
description = "A pure functional functional language that uses the HVM."
|
||||
repository = "https://github.com/Kindelia/Kind2"
|
||||
|
@ -617,6 +617,7 @@ impl<'a> Parser<'a> {
|
||||
self.advance(); // 'open'
|
||||
let type_name = self.parse_upper_id()?;
|
||||
let var_name = self.parse_id()?;
|
||||
self.check_and_eat(Token::Semi);
|
||||
let next = self.parse_expr(false)?;
|
||||
let end = next.range;
|
||||
|
||||
|
@ -466,16 +466,34 @@ impl Display for Match {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error> {
|
||||
write!(f, "match {} {}", self.typ, self.scrutinee)?;
|
||||
|
||||
match &self.motive {
|
||||
None => Ok(()),
|
||||
Some(res) => write!(f, " : {}", res),
|
||||
}?;
|
||||
if let Some(res) = &self.value {
|
||||
write!(f, " = {}", res)?;
|
||||
}
|
||||
|
||||
if !self.with_vars.is_empty() {
|
||||
write!(f, " with")?;
|
||||
for var in &self.with_vars {
|
||||
if let Some(ty) = &var.1 {
|
||||
write!(f, " ({} : {})", var.0, ty)?;
|
||||
} else {
|
||||
write!(f, " {}", var.0)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
write!(f, " {{ ")?;
|
||||
|
||||
for case in &self.cases {
|
||||
write!(f, "{}; ", case)?
|
||||
}
|
||||
write!(f, "}}")
|
||||
|
||||
write!(f, "}}")?;
|
||||
|
||||
if let Some(res) = &self.motive {
|
||||
write!(f, " : {}", res)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -303,6 +303,7 @@ impl Display for Book {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error> {
|
||||
for entr in self.entries.values() {
|
||||
match entr {
|
||||
TopLevel::Entry(entr) if entr.generated_by.is_some() => (),
|
||||
_ => write!(f, "{}", entr)?,
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user