atom / node-oniguruma

Oniguruma Node Module
http://atom.github.io/node-oniguruma
MIT License
121 stars 46 forks source link

Standardizing OnigScanner's second parameter #81

Open zikaari opened 6 years ago

zikaari commented 6 years ago

I maintain WebAssembly port of oniguruma called onigasm which is, and preferably should remain, 1:1 API compatible with node-oniguruma.

Certain circumstances now require OnigScanner's ability to use regex syntaxes/flavours other than default oniguruma syntax.

Now, of course that change doesn't need to be part of node-oniguruma right now, but if only node-oniguruma and onigasm could sync up on the new spec that'd be super cool.

Current API as of oniguruma@7.0.0

OnigScanner(patterns: string[])
OnigRegExp(pattern: string)

Proposed API (whenever `node-oniguruma decides to get on board)


type OnigOptions = {
syntax: 'perl' | 'java' | 'ruby' | 'grep' | 'posix'
}

OnigScanner(patterns: string[], options?: OnigOptions) OnigRegExp(pattern: string, options?: OnigOptions)