Rename some tokens to standartize naming

This commit is contained in:
dkanus 2025-09-16 08:17:33 +07:00
parent 2a31ed08b8
commit 7ed934e2b8

View File

@ -267,9 +267,9 @@ pub enum Token {
Minus, Minus,
// ## String manipulation // ## String manipulation
#[token("@")] #[token("@")]
AtChar, ConcatSpace,
#[token("$")] #[token("$")]
DollarChar, Concat,
// ## Shifts // ## Shifts
#[token("<<")] #[token("<<")]
LeftShift, LeftShift,
@ -328,9 +328,9 @@ pub enum Token {
// # Punctuation & delimiters // # Punctuation & delimiters
#[token("(")] #[token("(")]
LeftParen, LeftParenthesis,
#[token(")")] #[token(")")]
RightParen, RightParenthesis,
#[token("{", handle_brace)] #[token("{", handle_brace)]
Brace(BraceKind), Brace(BraceKind),
#[token("}")] #[token("}")]
@ -358,7 +358,7 @@ pub enum Token {
#[regex(r"/\*", handle_block_comment)] #[regex(r"/\*", handle_block_comment)]
BlockComment, BlockComment,
#[regex(r"\r\n|\n|\r")] #[regex(r"\r\n|\n|\r")]
NewLine, Newline,
#[regex(r"[ \t]+")] #[regex(r"[ \t]+")]
Whitespace, Whitespace,
@ -369,7 +369,7 @@ pub enum Token {
impl Token { impl Token {
/// Returns `true` if this token is a newline (`Token::NewLine`). /// Returns `true` if this token is a newline (`Token::NewLine`).
pub fn is_newline(&self) -> bool { pub fn is_newline(&self) -> bool {
matches!(self, Token::NewLine) matches!(self, Token::Newline)
} }
/// Returns `true` if this token is trivia whitespace /// Returns `true` if this token is trivia whitespace
@ -377,7 +377,7 @@ impl Token {
/// ///
/// Note: comments are **not** considered whitespace. /// Note: comments are **not** considered whitespace.
pub fn is_whitespace(&self) -> bool { pub fn is_whitespace(&self) -> bool {
matches!(&self, Token::Whitespace | Token::NewLine) matches!(&self, Token::Whitespace | Token::Newline)
} }
/// Returns `true` if this token may span multiple physical lines /// Returns `true` if this token may span multiple physical lines