Skip to content

Commit 5320ad7

Browse files
committed
Clarify endOnSpace special case
1 parent ed353ce commit 5320ad7

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/parser/Parser.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,17 @@ export class Parser {
141141
}
142142

143143
/**
144-
* If this text must end on space, then it must not endOnQuote (implies that the space is part of the entire text)
145-
* When we encounter a space, then we must split the current token into 2 tokens and only consume the first half
144+
* SPECIAL CASE:
145+
* If we encounter a space, then we must split the current token into 2 tokens and only consume the first part
146146
*
147-
* <a b> -> <a>< b>
148-
* | | |
149-
* | | idx (new)
150-
* | |
151-
* idx (consumed)
147+
* a b -> a b
148+
* | | |
149+
* | | idx (new)
150+
* | |
151+
* idx consumed
152+
*
153+
* Note: We only handle endOnSpace special case when we don't expect the current text to endOnQuotes
154+
* If it endOnQuotes, then it implies that it opened with quotes (and thus we need an enclosing/matching quote)
152155
*/
153156
if (endOnSpace && !endOnQuotes) {
154157
const origStr = stringifyTokens(ogText, [tokens[idx]])

0 commit comments

Comments
 (0)