Skip to content

Commit

Permalink
remove: select, then, else, <-, and ..=
Browse files Browse the repository at this point in the history
- Remove `select` keyword and `<-` operator (closes #31)
- Remove `then` and `else` keywords (closes #32)
- Remove `..=` operator (closes #33)
  • Loading branch information
adamchristiansen committed Feb 4, 2025
1 parent 91f27f6 commit 3e84cf4
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 20 deletions.
10 changes: 0 additions & 10 deletions src/compiler/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,14 +292,12 @@ impl<'a> Lexer<'a> {
[Some(','), ..] => self.advance_by_and_emit(1, Token::Comma),
[Some('-'), Some('>'), ..] => self.advance_by_and_emit(2, Token::MinusGt),
[Some('-'), ..] => self.advance_by_and_emit(1, Token::Minus),
[Some('.'), Some('.'), Some('='), ..] => self.advance_by_and_emit(3, Token::DotDotEq),
[Some('.'), Some('.'), ..] => self.advance_by_and_emit(2, Token::DotDot),
[Some('.'), ..] => self.advance_by_and_emit(1, Token::Dot),
[Some('/'), ..] => self.advance_by_and_emit(1, Token::Slash),
[Some(':'), Some(':'), ..] => self.advance_by_and_emit(2, Token::ColonColon),
[Some(':'), ..] => self.advance_by_and_emit(1, Token::Colon),
[Some(';'), ..] => self.advance_by_and_emit(1, Token::Semicolon),
[Some('<'), Some('-'), ..] => self.advance_by_and_emit(2, Token::LtMinus),
[Some('<'), Some('='), ..] => self.advance_by_and_emit(2, Token::LtEq),
[Some('<'), ..] => self.advance_by_and_emit(2, Token::Lt),
[Some('='), Some('='), ..] => self.advance_by_and_emit(2, Token::EqEq),
Expand Down Expand Up @@ -412,7 +410,6 @@ impl<'a> Lexer<'a> {
match self.as_marked_str() {
// Keywords.
"as" => self.emit(Token::KwAs),
"else" => self.emit(Token::KwElse),
"export" => self.emit(Token::KwExport),
"fn" => self.emit(Token::KwFn),
"if" => self.emit(Token::KwIf),
Expand All @@ -423,9 +420,7 @@ impl<'a> Lexer<'a> {
"nonexhaustive" => self.emit(Token::KwNonexhaustive),
"provide" => self.emit(Token::KwProvide),
"return" => self.emit(Token::KwReturn),
"select" => self.emit(Token::KwSelect),
"self" => self.emit(Token::KwSelf),
"then" => self.emit(Token::KwThen),
"transparent" => self.emit(Token::KwTransparent),
"type" => self.emit(Token::KwType),
"use" => self.emit(Token::KwUse),
Expand Down Expand Up @@ -802,15 +797,13 @@ mod tests {
scan!("::", ok: Token::ColonColon);
scan!(".", ok: Token::Dot);
scan!("..", ok: Token::DotDot);
scan!("..=", ok: Token::DotDotEq);
scan!("=", ok: Token::Eq);
scan!("==", ok: Token::EqEq);
scan!("=>", ok: Token::EqGt);
scan!(">", ok: Token::Gt);
scan!(">=", ok: Token::GtEq);
scan!("<", ok: Token::Lt);
scan!("<=", ok: Token::LtEq);
scan!("<-", ok: Token::LtMinus);
scan!("-", ok: Token::Minus);
scan!("->", ok: Token::MinusGt);
scan!("%", ok: Token::Percent);
Expand Down Expand Up @@ -1012,7 +1005,6 @@ mod tests {
#[test]
fn scan_keywords() {
scan!("as", ok: Token::KwAs);
scan!("else", ok: Token::KwElse);
scan!("export", ok: Token::KwExport);
scan!("fn", ok: Token::KwFn);
scan!("if", ok: Token::KwIf);
Expand All @@ -1023,9 +1015,7 @@ mod tests {
scan!("nonexhaustive", ok: Token::KwNonexhaustive);
scan!("provide", ok: Token::KwProvide);
scan!("return", ok: Token::KwReturn);
scan!("select", ok: Token::KwSelect);
scan!("self", ok: Token::KwSelf);
scan!("then", ok: Token::KwThen);
scan!("transparent", ok: Token::KwTransparent);
scan!("type", ok: Token::KwType);
scan!("use", ok: Token::KwUse);
Expand Down
10 changes: 0 additions & 10 deletions src/compiler/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ pub enum Token {
Underscore,
/// The `as` keyword.
KwAs,
/// The `else` keyword.
KwElse,
/// The `export` keyword.
KwExport,
/// The `fn` keyword.
Expand All @@ -50,12 +48,8 @@ pub enum Token {
KwProvide,
/// The `return` keyword.
KwReturn,
/// The `select` keyword.
KwSelect,
/// The `self` keyword.
KwSelf,
/// The `then` keyword.
KwThen,
/// The `transparent` keyword.
KwTransparent,
/// The `type` keyword.
Expand Down Expand Up @@ -122,8 +116,6 @@ pub enum Token {
Dot,
/// `..`.
DotDot,
/// `..=`.
DotDotEq,
/// `=`.
Eq,
/// `==`.
Expand All @@ -138,8 +130,6 @@ pub enum Token {
Lt,
/// `<=`.
LtEq,
/// `<-`.
LtMinus,
/// `-`.
Minus,
/// `->`.
Expand Down

0 comments on commit 3e84cf4

Please sign in to comment.