Skip to content

Commit

Permalink
Demo: Highlight comparison differences
Browse files Browse the repository at this point in the history
  • Loading branch information
slevithan committed Nov 10, 2024
1 parent dd27f42 commit 039cc3a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Compared to running the Oniguruma C library via WASM bindings using [vscode-onig

### [Try the demo REPL](https://slevithan.github.io/oniguruma-to-es/demo/)

Oniguruma-To-ES deeply understands the hundreds of large and small differences between Oniguruma and JavaScript regex syntax and behavior across multiple JavaScript version targets. It's *obsessive* about ensuring that the emulated features it supports have **exactly the same behavior**, even in extreme edge cases. And it's been battle-tested on thousands of real-world Oniguruma regexes used in TextMate grammars (via the Shiki library). A few uncommon features can't be perfectly emulated and allow rare differences, but if you don't want to allow this, you can set the `accuracy` option to throw for such patterns (see details below).
Oniguruma-To-ES deeply understands the hundreds of large and small differences between Oniguruma and JavaScript regex syntax and behavior, across multiple JavaScript version targets. It's *obsessive* about ensuring that the emulated features it supports have **exactly the same behavior**, even in extreme edge cases. And it's been battle-tested on thousands of real-world Oniguruma regexes used in TextMate grammars (via the Shiki library). A few uncommon features can't be perfectly emulated and allow rare differences, but if you don't want to allow this, you can set the `accuracy` option to throw for such patterns (see details below).

## 📜 Contents

Expand Down Expand Up @@ -268,7 +268,7 @@ Disables optimizations that simplify the pattern when it doesn't change the mean
Following are the supported features by target. The official Oniguruma [syntax doc](https://github.com/kkos/oniguruma/blob/master/doc/RE) doesn't cover many of the finer details described here.

> [!NOTE]
> Targets `ES2024` and `ES2025` have the same emulation capabilities. Resulting regexes might have different source and flags, but they match the same strings.
> Targets `ES2024` and `ES2025` have the same emulation capabilities. Resulting regexes might have different source and flags, but they match the same strings. See [`target`](#target).
Notice that nearly every feature below has at least subtle differences from JavaScript. Some features and subfeatures listed as unsupported are not emulatable using native JavaScript regexes, but support for others might be added in future versions of this library. Unsupported features throw an error.

Expand Down Expand Up @@ -683,7 +683,7 @@ Notice that nearly every feature below has at least subtle differences from Java
<td align="middle">✅</td>
<td align="middle">✅</td>
<td>
✔ <code>+</code> suffix doesn't make interval <code>{…}</code> quantifiers possessive (creates a quantifier chain)<br>
✔ <code>+</code> suffix doesn't make <code>{…}</code> interval quantifiers possessive (creates a quantifier chain)<br>
</td>
</tr>
<tr valign="top">
Expand Down
4 changes: 2 additions & 2 deletions demo/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ function showTranspiled() {
const withDiff = [];
differents.forEach(d => (d.error ? withError : withDiff).push(d));
if (withError.length) {
str += ` Can't emulate for ${listDifferents(withError)}.`;
str += ` <b>Can't emulate</b> for ${listDifferents(withError)}.`;
}
if (withDiff.length) {
str += ` Emulation ${details.error ? 'is possible' : 'used different details'} for ${listDifferents(withDiff)}.`;
str += ` Emulation <b>${details.error ? 'is possible' : 'used different details'}</b> for ${listDifferents(withDiff)}.`;
}
ui.comparisonInfo.innerHTML = `<p>🔀 ${str}</p>`;
} else {
Expand Down

0 comments on commit 039cc3a

Please sign in to comment.