generated from musicparty/template
WIP: Tracking PR for initial parser #4
Reference in New Issue
Block a user
Delete Branch "feature/parser"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@tommy /review
Pull request overview
Parser loop skips first byte; non-apidoc comments aren't skipped to EOL, causing incorrect scanning.
PR #4: WIP: Tracking PR for initial parser
Good start. Biggest issues are the cursor pre-bump (missing comments at offset 0) and not advancing to end-of-line when a
//comment isn't an apidoc comment, which can cause scanning inside the same comment line. Fixing those will make the parser more reliable.Important
parse()currently skips the very first character of the input because the cursor is bumped at the start of the loop. This will miss comments at the start of the file. Consider changing the loop structure to avoid pre-incrementing before inspection.Nice to have
println!anddbg!from a library crate, which will be noisy for callers and makes it hard to use in non-CLI contexts. Consider gating with a feature or removing once debugging is done.Debug: raw JSON
See summary comment above for details.
File: src/apidoc_parser/src/lib.rs:17 (bug)
The loop advances the cursor before inspecting
slice, which skips the very first character of the file. As a result, a comment that starts at byte 0 will never be detected. Consider checkingis_finished()before bumping or moving the bump to the end of the loop.File: src/apidoc_parser/src/lib.rs:27 (important)
When a
//comment is not an apidoc comment, youcontinuewithout advancing to end-of-line. This leaves the cursor in the middle of the same line and can cause repeated scanning within the comment body (and potentially false positives if//appears again). You likely want to skip to the newline before continuing.This is a tracking PR.
I get that this is a tracking / WIP PR, but I still think early feedback here is valuable.
Parser logic is pretty sensitive, and catching things like cursor movement and skipping behavior early can save us from baking in assumptions that are harder to unwind later. Even with just one commit, Tommy may have highlighted areas that would otherwise not be revisited later, which is why I still think this feedback is valuable.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.