Skip to content

Code comment request: explanatory comment for templateLitReg (parse.ts) #371

Description

@jayaddison

This regex is used to find closing multiline strings, if I interpret its usage correctly.

However: it's not super clear to me how the pattern -- or the subpatterns within it -- work when matching. I think a lot of relates to handling variable/call interpolation syntax (e.g. ${x + 1}).
it
I'm not the best at comprehending regular expressions, but perhaps a short paragraph before the pattern could help to explain how it functions.

Ref:

var templateLitReg = /`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g

Edit: add code link

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions