Closed gajus closed 2 years ago
This is the issue that I am trying to solve:
https://github.com/kach/nearley/issues/595
I want to match all regular expressions.
So far I have this:
regex -> regex_body regex_flags {% d => d.join('') %} regex_body -> "/" regex_body_char:* "/" {% d => '/' + d[1].join('') + '/' %} regex_body_char -> [^\\] {% id %} | "\\" strescape {% d => JSON.parse("\""+d.join("")+"\"") %} regex_flags -> null | [gmiyusd]:+ {% d => d[0].join('') %} strescape -> ["\\/bfnrt] {% id %} | "u" [a-fA-F0-9] [a-fA-F0-9] [a-fA-F0-9] [a-fA-F0-9] {% function(d) { return d.join(""); } %}
but it fails with /\s/. I wonder if moo can help here?
/\s/
Looks like this works just fine:
regex_body_char -> [^\\] {% id %} | "\\" [^\\] {% d => '\\' + d[1] %}
This is the issue that I am trying to solve:
https://github.com/kach/nearley/issues/595
I want to match all regular expressions.
So far I have this:
but it fails with
/\s/
. I wonder if moo can help here?