Skip to content

Fix the line number for rules produced inside a sigil_SHEET#77

Merged
bcardarella merged 1 commit into
mainfrom
nk-fix-line-number-for-block
Aug 8, 2024
Merged

Fix the line number for rules produced inside a sigil_SHEET#77
bcardarella merged 1 commit into
mainfrom
nk-fix-line-number-for-block

Conversation

@NduatiK

@NduatiK NduatiK commented Aug 7, 2024

Copy link
Copy Markdown
Contributor

Required to fix bug in liveview-native/liveview-client-swiftui#1402.


Currently, the sigil_SHEET parses blocks and hands the block contents to a sigil_RULES. We don't pass down any line information to the sigil_RULES. The parser used by the sigil_RULES will not receive information about the location of the block contents it is parsing.

In the sheet below, the rules parser will treat rule-blue and rule-yellow as though they are at the same location. Both are assumed to be on line 3 (1 (Location of sheet parser) + 1 (location of block in sheet) + 1 (location of rule in block)).

1 | ~SHEET"""
2 | "color-blue" do
3 |   rule-blue
4 | end
5 | 
6 | "color-yellow" do
7 |   rule-yellow
8 | end
9 | """

This PR passes block line information from the sheet parser down to the rules parser which allows for more correct errors and warnings. In the example above, rule-blue will be on line 3 and rule-yellow on line 7.

@NduatiK
NduatiK requested a review from bcardarella August 8, 2024 12:31
@bcardarella

Copy link
Copy Markdown
Contributor

I like it!

@bcardarella
bcardarella merged commit 05639ca into main Aug 8, 2024
@bcardarella
bcardarella deleted the nk-fix-line-number-for-block branch August 8, 2024 12:34
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