benjamn / ast-types

Esprima-compatible implementation of the Mozilla JS Parser API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AST nodes for regular expressions lack `regex` property

mathiasbynens opened this issue · comments

AST nodes for regular expressions should have a regex property that holds an object like { pattern: '…', flags: 'g' }.

See https://github.com/estree/estree/blob/master/spec.md#regexliteral & https://github.com/shapesecurity/shift-spec/blob/56ec0f6020f039ca6f8c798f08be8227d6e068bb/spec.idl#L253-L256

Do any parsers support this yet? That is, do they actually produce a node with .type === "RegexLiteral" rather than a node with .type === "Literal" and .value instanceof RegExp?

I submitted some feedback as a PR to ESTree: estree/estree#76