From ee1b868ea3ff3bdeebe7284ab0964962d5e8c0cd Mon Sep 17 00:00:00 2001 From: Steven Levithan Date: Tue, 19 Nov 2024 11:59:45 +0100 Subject: [PATCH] Support top-level flag W --- README.md | 13 ++++++++++++- demo/demo.js | 11 ++++++++++- demo/index.html | 5 +++++ src/generate.js | 8 ++++++-- src/parse.js | 44 +++++++++++++++++++++++++++----------------- src/tokenize.js | 9 ++++++--- src/transform.js | 18 +++++++++++------- 7 files changed, 77 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 86a4e32..f36d84c 100644 --- a/README.md +++ b/README.md @@ -265,7 +265,7 @@ Notice that nearly every feature below has at least subtle differences from Java - Flags + Flags i i ✅ @@ -297,6 +297,17 @@ Notice that nearly every feature below has at least subtle differences from Java ✔ Whitespace and # not ignored in char classes
+ + W + W + ✅ + ✅ + + ● Currently supported only as a top-level flag
+ ✔ POSIX [[:word:]] and \p{Word} are ASCII based
+ ✔ \b is ASCII based
+ + Flag modifiers diff --git a/demo/demo.js b/demo/demo.js index 0740091..b50bdbd 100644 --- a/demo/demo.js +++ b/demo/demo.js @@ -10,6 +10,7 @@ const state = { i: getValue('flag-i'), m: getValue('flag-m'), x: getValue('flag-x'), + W: getValue('flag-W'), }, opts: { accuracy: getValue('option-accuracy'), @@ -66,7 +67,15 @@ function showTranspiled() { ui.subclassInfo.classList.add('hidden'); const options = { ...state.opts, - flags: `${state.flags.i ? 'i' : ''}${state.flags.m ? 'm' : ''}${state.flags.x ? 'x' : ''}`, + flags: `${ + state.flags.i ? 'i' : '' + }${ + state.flags.m ? 'm' : '' + }${ + state.flags.x ? 'x' : '' + }${ + state.flags.W ? 'W' : '' + }`, maxRecursionDepth: state.opts.maxRecursionDepth === '' ? null : +state.opts.maxRecursionDepth, target: state.opts.target === 'auto' ? autoTarget : state.opts.target, }; diff --git a/demo/index.html b/demo/index.html index 34d656d..32a05ae 100644 --- a/demo/index.html +++ b/demo/index.html @@ -35,6 +35,11 @@

Try it

x Insignificant whitespace and comments +