Skip to content

Commit

Permalink
fix: lex open and close parenthesis correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
nfejzic committed Jun 16, 2022
1 parent e88faf9 commit e891b97
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
14 changes: 6 additions & 8 deletions inline/src/lexer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,12 @@ impl Symbol<'_> {
match self {
Symbol::Star | Symbol::Underline => LexLength::Limited(3),

Symbol::Esc
| Symbol::Caret
| Symbol::Overline
| Symbol::Tick
| Symbol::Dollar
| Symbol::OpenParens => LexLength::Limited(1),

Symbol::CloseParens
Symbol::Esc | Symbol::Caret | Symbol::Overline | Symbol::Tick | Symbol::Dollar => {
LexLength::Limited(1)
}

Symbol::OpenParens
| Symbol::CloseParens
| Symbol::OpenBracket
| Symbol::CloseBracket
| Symbol::OpenBrace
Expand Down
8 changes: 6 additions & 2 deletions inline/src/lexer/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,9 @@ impl Token {
} else {
let not_followed_by_whitespace = matches!(self.spacing, Spacing::Pre | Spacing::None);

self.is_nesting_token() && not_followed_by_whitespace
!self.kind.is_close_parentheses()
&& self.is_nesting_token()
&& not_followed_by_whitespace
}
}

Expand All @@ -263,7 +265,9 @@ impl Token {
} else {
let not_preceded_by_whitespace = matches!(self.spacing, Spacing::Post | Spacing::None);

self.is_nesting_token() && not_preceded_by_whitespace
!self.kind().is_open_parentheses()
&& self.is_nesting_token()
&& not_preceded_by_whitespace
}
}

Expand Down

0 comments on commit e891b97

Please sign in to comment.