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.
This PR fixes a bug with
firstIndent
in thereduceLines
function. TheIndent
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 theTagName
token because of the "orphaned" space character in front. For example, in this case (symbol⊔
represents a space) :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 anIndetifier
token.