Avoid emitting empty logical lines (#4452)

This commit is contained in:
Charlie Marsh 2023-05-16 12:33:33 -04:00 committed by GitHub
parent 4b05ca1198
commit 7e0d018b35
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 45 additions and 5 deletions

View file

@ -167,6 +167,11 @@ pub enum TokenKind {
}
impl TokenKind {
#[inline]
pub const fn is_newline(&self) -> bool {
matches!(self, TokenKind::Newline | TokenKind::NonLogicalNewline)
}
#[inline]
pub const fn is_unary(&self) -> bool {
matches!(self, TokenKind::Plus | TokenKind::Minus | TokenKind::Star)