Skip to content

Commit e53c187

Browse files
committed
some unused warnings in grammar, get compiling with logos-0.11.0-rc2
1 parent 70cd760 commit e53c187

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

src/lex.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ pub use logos::Lexer;
22
use logos::Logos;
33

44
#[derive(Logos, Debug, Clone, PartialEq)]
5-
#[logos(trivia = r"(\p{Whitespace}+|#.*\n)")]
5+
#[logos(trivia = r"(\p{Whitespace}+|;;.*\n)")]
66
pub enum Token<'a> {
7+
#[token = ","]
8+
Comma,
9+
710
#[token = "."]
811
Dot,
912

@@ -82,10 +85,6 @@ pub enum Token<'a> {
8285
#[token = "]"]
8386
RBrack,
8487

85-
// Name ↔ Name
86-
#[regex = r"[a-zA-Z][_a-zA-Z0-9]*"]
87-
Name,
88-
8988
// Since this uses Coptic letters for keywords all greek letters can be used as variable names.
9089
// Variables can start with a slash character, a greek/math alphanumeric symbol,
9190
// and ascii letters numbers, and subscripts (TODO superscripts)
@@ -152,7 +151,8 @@ impl<'a> std::fmt::Display for Token<'a> {
152151
Token::RParen => write!(f, ")"),
153152
Token::LBrack => write!(f, "["),
154153
Token::RBrack => write!(f, "]"),
155-
Token::Name(s) => write!(f, "{}", s),
154+
Token::Name(s) | Token::FancyNameAscii(s) => write!(f, "{}", s),
155+
Token::LexError => write!(f, "Lexical Error"),
156156
}
157157
}
158158
}

src/prop.lalrpop

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,17 @@ name: &'a str = {
4141
pub prop = Semi<Binding>;
4242

4343
Binding: () = {
44-
<n:name> "≔" <s:Stmt> => (),
45-
<n:name> ":" <t:Prop> "≔" <s:Stmt> => (),
44+
<_n:name> "≔" <_s:Stmt> => (),
45+
<_n:name> ":" <_t:Prop> "≔" <_s:Stmt> => (),
4646
}
4747
Stmt: () = {
48-
<s: Stmt> "‣" <t:Thus> => (),
48+
<_s: Stmt> "‣" <_t:Thus> => (),
4949
Thus => (),
5050
}
5151

5252
Thus: () = {
53-
<t:Thus> <p: ("∴" PropOpt)> => (),
54-
<t:Thus> "." <p:PropOpt> => (),
53+
<_t:Thus> <_p: ("∴" PropOpt)> => (),
54+
<_t:Thus> "." <_p:PropOpt> => (),
5555
PropOpt
5656
}
5757

@@ -67,7 +67,7 @@ Semi<T>: Vec<T> = {
6767
}
6868

6969
Prop: () = {
70-
"¬" <t:BinaryProp> => (),
70+
"¬" <_t:BinaryProp> => (),
7171
BinaryProp,
7272
}
7373

@@ -77,20 +77,20 @@ PropOpt: () = {
7777
}
7878

7979
BinaryProp: () = {
80-
<p1:BinaryProp> "∧" <p2:Atom> => (),
81-
<p1:BinaryProp> "∨" <p2:Atom> => (),
82-
<p1:BinaryProp> "→" <p2:Atom> => (),
83-
<p1:BinaryProp> "↔" <p2:Atom> => (),
84-
<p1:BinaryProp> "∧" "¬" <p2:Atom> => (),
85-
<p1:BinaryProp> "∨" "¬" <p2:Atom> => (),
86-
<p1:BinaryProp> "→" "¬" <p2:Atom> => (),
87-
<p1:BinaryProp> "↔" "¬" <p2:Atom> => (),
80+
<_p1:BinaryProp> "∧" <_p2:Atom> => (),
81+
<_p1:BinaryProp> "∨" <_p2:Atom> => (),
82+
<_p1:BinaryProp> "→" <_p2:Atom> => (),
83+
<_p1:BinaryProp> "↔" <_p2:Atom> => (),
84+
<_p1:BinaryProp> "∧" "¬" <_p2:Atom> => (),
85+
<_p1:BinaryProp> "∨" "¬" <_p2:Atom> => (),
86+
<_p1:BinaryProp> "→" "¬" <_p2:Atom> => (),
87+
<_p1:BinaryProp> "↔" "¬" <_p2:Atom> => (),
8888
Atom,
8989
}
9090

9191
Atom: () = {
9292
"⊤" => (),
9393
"(" Prop ")" => (),
94-
<n:name> => (),
94+
<_n:name> => (),
9595
};
9696

0 commit comments

Comments
 (0)