LeaVerou/parsel

Fails to parse selector list of non-trivial selectors

matheus23 opened this issue · 2 comments

I tried to parse this: .prose ul ul, .prose ul ol, .prose ol ul, .prose ol ol succeeds tokenizing, but fails with the error:

Error: Incorrect comma at 0
nestTokens@https://projects.verou.me/parsel/parsel.js:173:12
nestTokens@https://projects.verou.me/parsel/parsel.js:205:11
nestTokens@https://projects.verou.me/parsel/parsel.js:176:15
parse@https://projects.verou.me/parsel/parsel.js:244:22
tryout.oninput@https://projects.verou.me/parsel/:126:44
EventHandlerNonNull*@https://projects.verou.me/parsel/:120:2

(in the web version)

Here's some input-debugging:

  • a, b c, d fails with Incorrect comma at 0.
  • b c, d works.
  • a, b c works.
  • a, b c, fails with Incorrect comma at 0 (even though I'd expect another error)
  • a, b, d works.

I'm not sure what's happening. It has something to do with a non-trivial selector in the second item in the list.

Also: It'd be great to have this as an npm module uploaded. Is that planned? :)

Oh wow. Thank you, looking into it now.

Bug should be fixed, and the code is actually more readable now. Thank you! :)

Also: It'd be great to have this as an npm module uploaded. Is that planned? :)

Here you go! https://www.npmjs.com/package/parsel-js