Skip to content

Add additional code comments - #312

Open
fourls wants to merge 1 commit into
integrated-application-development:masterfrom
fourls:comments
Open

Add additional code comments#312
fourls wants to merge 1 commit into
integrated-application-development:masterfrom
fourls:comments

Conversation

@fourls

@fourls fourls commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

This PR adds or updates a whole bunch of comments across the source code, focusing particularly on describing what things are so that when you're in the weeds it's easy to keep track of everything.

Feel free to nitpick or tweak as much as you like.

@fourls
fourls requested a review from jgardn3r August 12, 2026 05:10
@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@jgardn3r jgardn3r left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! Seems like a pretty good first pass. Makes me want to change the names of some thing XD. This is my first once over, I will need to stew on some of them a little, I think.

current = next_token_types.pop();

// After the current token, some contexts needs to be popped
// Spring cleaning on contexts that are no longer needed

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Spring cleaning on contexts that are no longer needed
// Remove contexts that are no longer needed

/// 1
/// {$else}
/// 2
/// {$endif};

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fairly sure the ; will be on the next line too.

Comment thread core/src/lang.rs
ParentLineChildComment,
/// Catch-all for logical lines whose semantics do not inform special formatting.
Unknown,
/// "Dead" logical lines that are not to be reformatted or reconstructed.

@jgardn3r jgardn3r Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additionally, this is also about a line being deleted. Since we can't straight up delete the lines, they are assigned to Voided to indicate they've been deleted.

Comment thread core/src/lang.rs
#[derive(Hash, Debug, Default, Clone, Copy, PartialEq, Eq)]
pub struct LineParent {
pub line_index: usize,
/// Token (as global token stream index) introducing the child line.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is more about what is the parent token of the line. The parent token then is the child line's gateway to being formatted because it is directly dependent on where the parent token gets formatted. Maybe something more like:

Suggested change
/// Token (as global token stream index) introducing the child line.
/// Token (as global token stream index) whose positioning dictates the formatting of the child line.

Comment thread core/src/lang.rs
self.line_type
}
/// Exclude this logical line from reconstruction and remove all its tokens.
/// Returns the removed tokens.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say something along the lines of "this is effectively deleting the line". As I said in another comment, thats not technically overly possible so this is what we are left with.

Comment thread core/src/lang.rs
}

/// Normalized token used by formatters.
/// Unlike [`RawToken`], the string content is mutable, so formatting passes can adjust token content.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also probably worth noting that it is now TokenType, i.e., all the token types have been finalised to the best of our ability.

Comment thread core/src/traits.rs
fn ignore_tokens(&self, input: (&[Token], &[LogicalLine]), token_marker: &mut TokenMarker);
}

/// Formatting stage that marks certain tokens to be removed during formatting.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Formatting stage that marks certain tokens to be removed during formatting.
/// Formatting stage that marks certain tokens to be removed during formatting.

/// Index of the current token in the line.
line_index: u32,
/// Precedence(0) contexts that should be rewritten to MemberAccess contexts.
/// This contains all Precedence(0) contexts that have not been marked as [`fluent`].

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this fluent docref supposed to link somewhere?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants