summaryrefslogtreecommitdiff
path: root/src/syntax/token.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2020-09-30 18:59:33 +0200
committerLaurenz <laurmaedje@gmail.com>2020-09-30 18:59:33 +0200
commit4077a7c11ea19b1b6b6b6fe3014b9018846cf21b (patch)
tree70e4c891c2c660b4136890cebbae7c375fe36c05 /src/syntax/token.rs
parent7cc279f7ae122f4c40592004dde89792c636b3c8 (diff)
Refactor raw blocks 💱
Diffstat (limited to 'src/syntax/token.rs')
-rw-r--r--src/syntax/token.rs22
1 files changed, 6 insertions, 16 deletions
diff --git a/src/syntax/token.rs b/src/syntax/token.rs
index e91a780c..b7d4c4e2 100644
--- a/src/syntax/token.rs
+++ b/src/syntax/token.rs
@@ -1,6 +1,5 @@
//! Tokenization.
-use super::span::Spanned;
use crate::length::Length;
/// A minimal semantic entity of source code.
@@ -86,21 +85,13 @@ pub enum Token<'s> {
terminated: bool,
},
- /// Raw text.
+ /// Raw block.
Raw {
- /// The raw text (not yet unescaped as for strings).
+ /// The raw text between the backticks.
raw: &'s str,
- /// Whether the closing backtick was present.
- terminated: bool,
- },
-
- /// Multi-line code block.
- Code {
- /// The language of the code block, if specified.
- lang: Option<Spanned<&'s str>>,
- /// The raw text (not yet unescaped as for strings).
- raw: &'s str,
- /// Whether the closing backticks were present.
+ /// The number of opening backticks.
+ backticks: usize,
+ /// Whether all closing backticks were present.
terminated: bool,
},
@@ -142,8 +133,7 @@ impl<'s> Token<'s> {
Self::Backslash => "backslash",
Self::Hashtag => "hashtag",
Self::UnicodeEscape { .. } => "unicode escape sequence",
- Self::Raw { .. } => "raw text",
- Self::Code { .. } => "code block",
+ Self::Raw { .. } => "raw block",
Self::Text(_) => "text",
Self::Invalid("*/") => "end of block comment",
Self::Invalid(_) => "invalid token",