fluree / db

Fluree database library
https://fluree.github.io/db/
Other
330 stars 21 forks source link

fix SPARQL unicode grammar regex for CLJS #817

Closed dpetran closed 3 days ago

dpetran commented 5 days ago

Clojure and Clojurescript default to using their respective platforms' RegExp implementations, and unfortunately the syntax for unicode characters is mutually incompatible.

I've tried several variations to get it to work in the same file, but have unfortunately failed. So the next best thing is the dumb solution, which is two separate grammars, one for cljs and one for clj.

The only difference is in the PN_CHARS_BASE terminal, where we need to specify the unicode flag (the (?u) prefix) and use ES2015 Unicode-aware regular expressions syntax: [\u{10000}-\u{EFFFF}].

These are the sources I used to figure it out: https://mathiasbynens.be/notes/es6-unicode-regex https://yo-dave.com/2018/04/20/notes-on-clojurescript-regular-expressions/