Skip to content

Commit 16cff07

Browse files
remove debug printing
1 parent d363087 commit 16cff07

File tree

1 file changed

+0
-19
lines changed

1 file changed

+0
-19
lines changed

crates/djls-template-ast/src/parser.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,34 +24,28 @@ impl Parser {
2424
while !self.is_at_end() {
2525
match self.next_node() {
2626
Ok(node) => {
27-
eprintln!("Adding node: {:?}", node);
2827
ast.add_node(node);
2928
had_nodes = true;
3029
}
3130
Err(ParserError::StreamError(Stream::AtEnd)) => {
32-
eprintln!("Stream at end, nodes: {:?}", ast.nodes());
3331
if !had_nodes {
3432
return Err(ParserError::StreamError(Stream::UnexpectedEof));
3533
}
3634
break;
3735
}
3836
Err(ParserError::ErrorSignal(Signal::SpecialTag(tag))) => {
39-
eprintln!("Got special tag: {}", tag);
4037
continue;
4138
}
4239
Err(ParserError::UnclosedTag(tag)) => {
43-
eprintln!("Got unclosed tag: {}", tag);
4440
return Err(ParserError::UnclosedTag(tag));
4541
}
4642
Err(e) => {
47-
eprintln!("Got error: {:?}", e);
4843
self.synchronize()?;
4944
continue;
5045
}
5146
}
5247
}
5348

54-
eprintln!("Final nodes: {:?}", ast.nodes());
5549
if !had_nodes {
5650
return Err(ParserError::StreamError(Stream::UnexpectedEof));
5751
}
@@ -98,7 +92,6 @@ impl Parser {
9892
TokenType::Text(s) => Ok(Node::Text(s.to_string())),
9993
TokenType::Whitespace(_) => self.next_node(),
10094
}?;
101-
eprintln!("{:?}", node);
10295
Ok(node)
10396
}
10497

@@ -154,18 +147,14 @@ impl Parser {
154147
}
155148

156149
fn parse_django_block(&mut self, s: &str) -> Result<Node, ParserError> {
157-
eprintln!("Parsing django block: {}", s);
158150
let bits: Vec<String> = s.split_whitespace().map(String::from).collect();
159151
let tag_name = bits.first().ok_or(AstError::EmptyTag)?.clone();
160-
eprintln!("Tag name: {}", tag_name);
161152

162-
eprintln!("Loaded specs: {:?}", self.specs);
163153
let specs = TagSpec::load_builtin_specs().unwrap_or_default();
164154

165155
// Check if this is a closing tag according to ANY spec
166156
for (_, spec) in specs.iter() {
167157
if Some(&tag_name) == spec.closing.as_ref() {
168-
eprintln!("Found closing tag: {}", tag_name);
169158
return Err(ParserError::ErrorSignal(Signal::SpecialTag(tag_name)));
170159
}
171160
}
@@ -174,7 +163,6 @@ impl Parser {
174163
for (_, spec) in specs.iter() {
175164
if let Some(intermediates) = &spec.intermediates {
176165
if intermediates.contains(&tag_name) {
177-
eprintln!("Found intermediate tag: {}", tag_name);
178166
return Err(ParserError::ErrorSignal(Signal::SpecialTag(tag_name)));
179167
}
180168
}
@@ -189,15 +177,12 @@ impl Parser {
189177
while !self.is_at_end() {
190178
match self.next_node() {
191179
Ok(node) => {
192-
eprintln!("Adding node: {:?}", node);
193180
children.push(node);
194181
}
195182
Err(ParserError::ErrorSignal(Signal::SpecialTag(tag))) => {
196-
eprintln!("Got special tag: {}", tag);
197183
if let Some(spec) = &tag_spec {
198184
// Check if this is a closing tag
199185
if Some(&tag) == spec.closing.as_ref() {
200-
eprintln!("Found matching closing tag: {}", tag);
201186
// Found our closing tag, create appropriate tag type
202187
let tag_node = if !branches.is_empty() {
203188
TagNode::Branching {
@@ -218,7 +203,6 @@ impl Parser {
218203
// Check if this is an intermediate tag
219204
if let Some(intermediates) = &spec.intermediates {
220205
if intermediates.contains(&tag) {
221-
eprintln!("Found intermediate tag: {}", tag);
222206
// Add current children as a branch and start fresh
223207
branches.push(TagNode::Block {
224208
name: tag.clone(),
@@ -231,18 +215,15 @@ impl Parser {
231215
}
232216
}
233217
// If we get here, it's an unexpected tag
234-
eprintln!("Unexpected tag: {}", tag);
235218
return Err(ParserError::UnexpectedTag(tag));
236219
}
237220
Err(e) => {
238-
eprintln!("Error: {:?}", e);
239221
return Err(e);
240222
}
241223
}
242224
}
243225

244226
// If we get here, we never found the closing tag
245-
eprintln!("Never found closing tag: {}", tag_name);
246227
Err(ParserError::UnclosedTag(tag_name))
247228
}
248229

0 commit comments

Comments
 (0)