Skip to content

Commit 8d0424f

Browse files
authored
chore: Remove unnecessary doc comments and inline code comments (#33)
1 parent ae80097 commit 8d0424f

5 files changed

Lines changed: 0 additions & 25 deletions

File tree

‎crates/plotnik-lib/src/diagnostics/message.rs‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
//! Diagnostic message types and related structures.
2-
31
use rowan::TextRange;
42

5-
/// Severity level of a diagnostic.
63
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
74
pub enum Severity {
85
#[default]
@@ -19,7 +16,6 @@ impl std::fmt::Display for Severity {
1916
}
2017
}
2118

22-
/// A suggested fix for a diagnostic.
2319
#[derive(Debug, Clone, PartialEq, Eq)]
2420
pub struct Fix {
2521
pub(crate) replacement: String,
@@ -35,7 +31,6 @@ impl Fix {
3531
}
3632
}
3733

38-
/// Related location information for a diagnostic.
3934
#[derive(Debug, Clone, PartialEq, Eq)]
4035
pub struct RelatedInfo {
4136
pub(crate) range: TextRange,
@@ -51,7 +46,6 @@ impl RelatedInfo {
5146
}
5247
}
5348

54-
/// A diagnostic message with location, message, severity, and optional fix.
5549
#[derive(Debug, Clone, PartialEq, Eq)]
5650
pub(crate) struct DiagnosticMessage {
5751
pub(crate) severity: Severity,

‎crates/plotnik-lib/src/diagnostics/mod.rs‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
//! Compiler diagnostics infrastructure.
2-
//!
3-
//! This module provides types for collecting and rendering diagnostic messages.
4-
51
mod message;
62
mod printer;
73

@@ -15,13 +11,11 @@ pub use printer::DiagnosticsPrinter;
1511

1612
use message::{DiagnosticMessage, Fix, RelatedInfo};
1713

18-
/// Collection of diagnostic messages from parsing and analysis.
1914
#[derive(Debug, Clone, Default)]
2015
pub struct Diagnostics {
2116
messages: Vec<DiagnosticMessage>,
2217
}
2318

24-
/// Builder for constructing a diagnostic message.
2519
#[must_use = "diagnostic not emitted, call .emit()"]
2620
pub struct DiagnosticBuilder<'a> {
2721
diagnostics: &'a mut Diagnostics,

‎crates/plotnik-lib/src/parser/grammar.rs‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,32 +18,27 @@ impl Parser<'_> {
1818
pub fn parse_root(&mut self) {
1919
self.start_node(SyntaxKind::Root);
2020

21-
// Track spans of unnamed defs to emit errors for non-last ones
2221
let mut unnamed_def_spans: Vec<TextRange> = Vec::new();
2322

2423
while !self.has_fatal_error() && (self.peek() != SyntaxKind::Error || !self.eof()) {
2524
// LL(2): Id followed by Equals → named definition (if PascalCase)
2625
if self.peek() == SyntaxKind::Id && self.peek_nth(1) == SyntaxKind::Equals {
2726
self.parse_def();
2827
} else {
29-
// Anonymous def: wrap expression in Def node
3028
let start = self.current_span().start();
3129
self.start_node(SyntaxKind::Def);
3230
let success = self.parse_expr_or_error();
3331
if !success {
34-
// Synchronize: consume remaining garbage until next def boundary
3532
self.synchronize_to_def_start();
3633
}
3734
self.finish_node();
38-
// Only track successfully parsed defs for validation
3935
if success {
4036
let end = self.last_non_trivia_end().unwrap_or(start);
4137
unnamed_def_spans.push(TextRange::new(start, end));
4238
}
4339
}
4440
}
4541

46-
// Emit errors for all unnamed defs except the last one
4742
if unnamed_def_spans.len() > 1 {
4843
for span in &unnamed_def_spans[..unnamed_def_spans.len() - 1] {
4944
let def_text = &self.source[usize::from(span.start())..usize::from(span.end())];
@@ -164,12 +159,10 @@ impl Parser<'_> {
164159
/// PascalCase identifiers without children become `Ref` nodes.
165160
/// PascalCase identifiers with children emit an error but parse as `Tree`.
166161
fn parse_tree(&mut self) {
167-
// Use checkpoint so we can decide Tree vs Ref after seeing the full content
168162
let checkpoint = self.checkpoint();
169163
self.push_delimiter(SyntaxKind::ParenOpen);
170164
self.bump(); // consume '('
171165

172-
// Track if this is a reference (PascalCase identifier)
173166
let mut is_ref = false;
174167
let mut ref_name: Option<String> = None;
175168

@@ -199,7 +192,6 @@ impl Parser<'_> {
199192
}
200193

201194
if self.peek() == SyntaxKind::Slash {
202-
// Supertype syntax - commit to Tree
203195
if is_ref {
204196
self.start_node_at(checkpoint, SyntaxKind::Tree);
205197
self.error("references cannot use supertype syntax (/)");

‎crates/plotnik-lib/src/parser/lexer.rs‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,21 +92,18 @@ fn split_string_literal(source: &str, span: Range<usize>, tokens: &mut Vec<Token
9292
let start = span.start;
9393
let end = span.end;
9494

95-
// Opening quote
9695
tokens.push(Token::new(
9796
quote_kind,
9897
range_to_text_range(start..start + 1),
9998
));
10099

101-
// Content (may be empty)
102100
if end - start > 2 {
103101
tokens.push(Token::new(
104102
SyntaxKind::StrVal,
105103
range_to_text_range(start + 1..end - 1),
106104
));
107105
}
108106

109-
// Closing quote
110107
tokens.push(Token::new(quote_kind, range_to_text_range(end - 1..end)));
111108
}
112109

‎crates/plotnik-lib/src/query/printer.rs‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,13 @@ impl<'q, 'src> QueryPrinter<'q, 'src> {
8080

8181
let defined: IndexSet<&str> = symbols.names().collect();
8282

83-
// Build map from name to body syntax node for cardinality lookup
8483
let mut body_nodes: HashMap<String, SyntaxNode> = HashMap::new();
8584
for def in self.query.root().defs() {
8685
if let (Some(name_tok), Some(body)) = (def.name(), def.body()) {
8786
body_nodes.insert(name_tok.text().to_string(), body.syntax().clone());
8887
}
8988
}
9089

91-
// Print all definitions in definition order
9290
for name in symbols.names() {
9391
let mut visited = IndexSet::new();
9492
self.format_symbol_tree(name, 0, &defined, &body_nodes, &mut visited, w)?;

0 commit comments

Comments
 (0)