Skip to content

fix(parser): report multiline text node start line - #141

Merged
zhengchun merged 1 commit into
antchfx:masterfrom
dajiaohuang:fix/multiline-text-line-numbers
Oct 28, 2026
Merged

zhengchun merged 1 commit into
antchfx:masterfrom
dajiaohuang:fix/multiline-text-line-numbers

Conversation

@dajiaohuang

Copy link
Copy Markdown
Contributor

Summary

  • Calculate each parsed node's line number from the source offset where its token begins.
  • Add a regression for text containing a newline on the same line as its opening element.

Why

With <root>first line\nsecond line</root>, the text node begins on line 1, but the previous incremental end-offset calculation reported line 2. Using the precomputed line-start offsets preserves the node's actual source line.

Checks

  • go test . -run '^(TestLineNumberForMultilineText|TestLineNumbers)$' -count=1
  • go test . -v -cover
  • gofmt and git diff --check

@zhengchun
zhengchun merged commit 9429919 into antchfx:master Oct 28, 2026
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