Skip to content

Conversation

zdenko
Copy link
Contributor

@zdenko zdenko commented Sep 18, 2021

This PR fixes a bug with firstIndent in the reduceLines function.
The Indent token consists of two space character groups or one tab.
In my previous, quick solution, I forgot to test cases with an odd number of spaces.
In such cases, the parser can't detect the TagName token because of the "orphaned" space character in front.
For example, in this case (symbol represents a space) :

var templateFoo = `div
⊔⊔⊔⊔⊔⊔⊔⊔⊔⊔⊔⊔⊔⊔⊔⊔⊔⊔⊔⊔span @name

there are 21 spaces. The parser will detect ten indents but will not detect LineBody token because of preceding space character (e.g., ⊔span).

To solve this, I added a rule for the TagName token, which now allows a single space character preceding an Indetifier token.

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.

1 participant