summaryrefslogtreecommitdiff
path: root/src/parse/tokens.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-03-11 12:22:27 +0100
committerLaurenz <laurmaedje@gmail.com>2022-03-11 12:22:27 +0100
commit5ce2a006b6d45d29be15e4562ae3ab4fc1b8e97c (patch)
tree454b25e04530adcdf08a161e1ab09abb33c0644c /src/parse/tokens.rs
parente6b532391deb1e30dc356c4d20dd48199f748f29 (diff)
Consistent block naming
Diffstat (limited to 'src/parse/tokens.rs')
-rw-r--r--src/parse/tokens.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/parse/tokens.rs b/src/parse/tokens.rs
index 91bbf9e8..752714fd 100644
--- a/src/parse/tokens.rs
+++ b/src/parse/tokens.rs
@@ -26,7 +26,7 @@ pub struct Tokens<'s> {
pub enum TokenMode {
/// Text and markup.
Markup,
- /// Blocks and expressions.
+ /// Keywords, literals and operators.
Code,
}
@@ -104,11 +104,11 @@ impl<'s> Iterator for Tokens<'s> {
let start = self.s.index();
let c = self.s.eat()?;
Some(match c {
- // Blocks and templates.
- '[' => NodeKind::LeftBracket,
- ']' => NodeKind::RightBracket,
+ // Blocks.
'{' => NodeKind::LeftBrace,
'}' => NodeKind::RightBrace,
+ '[' => NodeKind::LeftBracket,
+ ']' => NodeKind::RightBracket,
// Whitespace.
' ' if self.s.check_or(true, |c| !c.is_whitespace()) => NodeKind::Space(0),
@@ -741,18 +741,18 @@ mod tests {
#[test]
fn test_tokenize_brackets() {
// Test in markup.
- t!(Markup: "[" => LeftBracket);
- t!(Markup: "]" => RightBracket);
t!(Markup: "{" => LeftBrace);
t!(Markup: "}" => RightBrace);
+ t!(Markup: "[" => LeftBracket);
+ t!(Markup: "]" => RightBracket);
t!(Markup[" /"]: "(" => Text("("));
t!(Markup[" /"]: ")" => Text(")"));
// Test in code.
- t!(Code: "[" => LeftBracket);
- t!(Code: "]" => RightBracket);
t!(Code: "{" => LeftBrace);
t!(Code: "}" => RightBrace);
+ t!(Code: "[" => LeftBracket);
+ t!(Code: "]" => RightBracket);
t!(Code: "(" => LeftParen);
t!(Code: ")" => RightParen);
}