getify/literalizer

fix how template literal is processed

Open

#26 geöffnet am 7. Jan. 2015

Auf GitHub ansehen
 (0 Kommentare) (0 Reaktionen) (1 zugewiesene Person)JavaScript (2 Forks)github user discovery
bughelp wanted

Repository-Metriken

Stars
 (18 Stars)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

There are quite a few problems with the existing implementation regarding template literals. Off the top of my head:

  1. the way it looks for the ending after starting a template literal is wrong. Instead of just looking for the next, it should count them in a stack, much like matching { } or ( ) pairs would be done.
  2. Template literals can have other template literals inside their expressions.
  3. Each ${ inside the literal should break out and just create elements of text (code), but must track { } pairs so it can identify the ending }, and go back into template literal mode, resuming its search for either ${ or ```.
  4. The tagged identifier before a template literal, if present, should be included as part of the first template literal element in the stream. heuristic: preceding whitespace then identifier.

Contributor Guide