Skip to content

fix(parser): handle nested Nim comments and add regression coverage - #44

Merged
Aaqibhafeezkhan merged 1 commit into
Aaqibhafeezkhan:mainfrom
sinzbtw:sinzbtw/test-nested-comments
Oct 31, 2026
Merged

Aaqibhafeezkhan merged 1 commit into
Aaqibhafeezkhan:mainfrom
sinzbtw:sinzbtw/test-nested-comments

Conversation

@sinzbtw

@sinzbtw sinzbtw commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #39. Add 42 regression cases for nested block comments, including mixed line endings, unterminated outer blocks, protected strings and ordinary comments in other profiles.

The tests cover Rust, Swift, Kotlin, Scala, Dart, Haskell, Julia, Nim and D. Three new cases expose a missing nesting delimiter for Nim. Include #[ in the existing nesting check so an inner ]# cannot end the outer comment early.

For example:

let a = 1 #[ outer #[ inner ]# outer ]#; echo a

Expected output: let a = 1 ; echo a. Before this fix the scanner returns let a = 1 outer ], losing the remaining code. Nim's multiline comment specification permits nesting.

Changes

  • Add test/nested-comments.test.js with behavior-focused cases.
  • Add Nim's delimiter to the existing nesting check.

Validation

  • Added or updated tests where behavior changed.
  • Ran npm test: 64 passed.
  • Checked the browser experience when UI behavior changed.
  • Updated documentation when needed.

The last two items are inapplicable to this scanner regression fix. UI behavior, dependencies and existing handling of other language profiles are unchanged.

@Aaqibhafeezkhan Aaqibhafeezkhan left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Reviewed against issue #39. The change adds representative nested-comment coverage for all nine supported nesting profiles, checks mixed line-ending preservation and unterminated outer blocks, protects delimiters inside strings, and verifies that non-nesting profiles retain their existing behavior. The Nim fix is narrowly scoped to recognizing #[ as a nesting opener, matching Nim's nested block-comment syntax. No correctness or scope issues found.

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.

test: cover nested block comments across supported languages

2 participants