summaryrefslogtreecommitdiff
path: root/src/parse
diff options
context:
space:
mode:
Diffstat (limited to 'src/parse')
-rw-r--r--src/parse/mod.rs4
-rw-r--r--src/parse/parser.rs10
-rw-r--r--src/parse/scanner.rs7
-rw-r--r--src/parse/tokens.rs11
4 files changed, 4 insertions, 28 deletions
diff --git a/src/parse/mod.rs b/src/parse/mod.rs
index 37b65c04..649b4eb8 100644
--- a/src/parse/mod.rs
+++ b/src/parse/mod.rs
@@ -201,7 +201,7 @@ fn list_item(p: &mut Parser) -> SyntaxNode {
let column = p.column(start);
p.eat_assert(Token::Hyph);
let body = tree_indented(p, column);
- SyntaxNode::List(Box::new(ListItem { span: p.span_from(start), body }))
+ SyntaxNode::List(Box::new(ListNode { span: p.span_from(start), body }))
}
/// Parse a single enum item.
@@ -210,7 +210,7 @@ fn enum_item(p: &mut Parser, number: Option<usize>) -> SyntaxNode {
let column = p.column(start);
p.eat_assert(Token::Numbering(number));
let body = tree_indented(p, column);
- SyntaxNode::Enum(Box::new(EnumItem {
+ SyntaxNode::Enum(Box::new(EnumNode {
span: p.span_from(start),
number,
body,
diff --git a/src/parse/parser.rs b/src/parse/parser.rs
index 83e77a6a..c035319d 100644
--- a/src/parse/parser.rs
+++ b/src/parse/parser.rs
@@ -1,4 +1,3 @@
-use std::fmt::{self, Debug, Formatter};
use std::ops::Range;
use super::{TokenMode, Tokens};
@@ -28,7 +27,6 @@ pub struct Parser<'s> {
}
/// A logical group of tokens, e.g. `[...]`.
-#[derive(Debug, Copy, Clone)]
struct GroupEntry {
/// The start index of the group. Used by `Parser::end_group` to return the
/// group's full span.
@@ -391,11 +389,3 @@ impl<'s> Parser<'s> {
self.groups.iter().any(|g| g.kind == kind)
}
}
-
-impl Debug for Parser<'_> {
- fn fmt(&self, f: &mut Formatter) -> fmt::Result {
- let mut s = self.tokens.scanner();
- s.jump(self.next_start());
- write!(f, "Parser({}|{})", s.eaten(), s.rest())
- }
-}
diff --git a/src/parse/scanner.rs b/src/parse/scanner.rs
index f893c4d3..8e3e4278 100644
--- a/src/parse/scanner.rs
+++ b/src/parse/scanner.rs
@@ -1,4 +1,3 @@
-use std::fmt::{self, Debug, Formatter};
use std::slice::SliceIndex;
/// A featureful char-based scanner.
@@ -153,12 +152,6 @@ impl<'s> Scanner<'s> {
}
}
-impl Debug for Scanner<'_> {
- fn fmt(&self, f: &mut Formatter) -> fmt::Result {
- write!(f, "Scanner({}|{})", self.eaten(), self.rest())
- }
-}
-
/// Whether this character denotes a newline.
#[inline]
pub fn is_newline(character: char) -> bool {
diff --git a/src/parse/tokens.rs b/src/parse/tokens.rs
index 684e340e..91d3ab7f 100644
--- a/src/parse/tokens.rs
+++ b/src/parse/tokens.rs
@@ -1,11 +1,8 @@
-use std::fmt::{self, Debug, Formatter};
-
use super::{is_newline, Scanner};
use crate::geom::{AngularUnit, LengthUnit};
use crate::syntax::*;
/// An iterator over the tokens of a string of source code.
-#[derive(Clone)]
pub struct Tokens<'s> {
s: Scanner<'s>,
mode: TokenMode,
@@ -481,12 +478,6 @@ impl<'s> Tokens<'s> {
}
}
-impl Debug for Tokens<'_> {
- fn fmt(&self, f: &mut Formatter) -> fmt::Result {
- write!(f, "Tokens({}|{})", self.s.eaten(), self.s.rest())
- }
-}
-
fn keyword(ident: &str) -> Option<Token<'static>> {
Some(match ident {
"not" => Token::Not,
@@ -512,6 +503,8 @@ fn keyword(ident: &str) -> Option<Token<'static>> {
#[cfg(test)]
#[allow(non_snake_case)]
mod tests {
+ use std::fmt::Debug;
+
use super::*;
use Option::None;