Merge pull request #13 from NoamDev/ascii-alternatives

Ascii alternatives to forall and lambda
This commit is contained in:
Victor Taelin 2024-05-25 15:07:50 -03:00 committed by GitHub
commit 80e3ff76c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -82,9 +82,15 @@ impl<'i> KindParser<'i> {
//println!("parsing ||{}", self.input[self.index..].replace("\n",""));
// ALL ::= ∀(<name>: <term>) <term>
if self.starts_with("") {
// "forall" can be used as an ascii alternative to "∀"
if self.starts_with("") || self.starts_with("forall") {
let ini = *self.index() as u64;
if self.starts_with("") {
self.consume("")?;
} else if self.starts_with("forall") {
self.consume("forall")?;
}
self.skip_spaces();
self.consume("(")?;
let nam = self.parse_name()?;
self.consume(":")?;
@ -97,9 +103,15 @@ impl<'i> KindParser<'i> {
}
// LAM ::= λ<name> <term>
if self.starts_with("λ") {
// "lambda" can be used as an ascii alternative to "λ"
if self.starts_with("λ") || self.starts_with("lambda") {
let ini = *self.index() as u64;
if self.starts_with("λ") {
self.consume("λ")?;
} else if self.starts_with("lambda") {
self.consume("lambda")?;
}
self.skip_spaces();
// Annotated
if self.peek_one() == Some('(') {
self.consume("(")?;