RunDevelopment / refa

A library for finite automata and regular expressions in the context of JS RegExp
MIT License
20 stars 3 forks source link

`JS.toLiteral`: Always allow `unicode: false` #48

Closed RunDevelopment closed 3 years ago

RunDevelopment commented 3 years ago

This resolves #47.

This branch is branched from #42.


This PR makes it so that JS.toLiteral will always allow unicode: false. This means that it will automatically convert Unicode regexes into UTF16 regexes.

I implemented the basic framework but there are still some open questions:

  1. Am I allowed to assume stable sorting?
  2. ~Can I just copy over the i flag from the Unicode regex?~ A: No.
  3. ~Does the detection for built-in assertions still work?~ A: Now it does.

~Also, this needs a bunch of testing.~ Other people build libraries just for the Unicode char set to UTF16 char set conversion.