From ecb7eb0cb4d84f4a6297a194b9e40484aa0c9982 Mon Sep 17 00:00:00 2001
From: Steven Levithan
Date: Fri, 25 Oct 2024 12:47:43 +0200
Subject: [PATCH] Demo: printAst
---
README.md | 6 +++---
demo/index.html | 33 ++++++++++++++++++++++++++++++++-
src/generate.js | 2 +-
3 files changed, 36 insertions(+), 5 deletions(-)
diff --git a/README.md b/README.md
index 1c39ec3..2b30baa 100644
--- a/README.md
+++ b/README.md
@@ -59,16 +59,16 @@ Sets the JavaScript language version for generated patterns and flags. Later tar
*Default: `'ES2024'`.*
-## Unicode, mixed case sensitivity
+## Unicode, mixed case-sensitivity
-Oniguruma-To-ES fully supports mixed case sensitivity (and handles the Unicode edge cases) regardless of JavaScript [target](#target). It also restricts Unicode properties to those supported by Oniguruma and the target JavaScript version.
+Oniguruma-To-ES fully supports mixed case-sensitivity (and handles the Unicode edge cases) regardless of JavaScript [target](#target). It also restricts Unicode properties to those supported by Oniguruma and the target JavaScript version.
Oniguruma-To-ES focuses on being lightweight to make it better for use in browsers. This is partly achieved by not including heavyweight Unicode character data, which imposes a couple of minor/rare restrictions:
- Character class intersection and nested negated classes are unsupported with target `ES2018`. Use target `ES2024` or later if you need support for these Oniguruma features.
- A handful of Unicode properties that target a specific character case (ex: `\p{Lower}`) can't be used case-insensitively in patterns that contain other characters with a specific case that are used case-sensitively.
- In other words, almost every usage is fine, inluding `A\p{Lower}`, `(?i:A\p{Lower})`, `(?i:A)\p{Lower}`, `(?i:A(?-i:\p{Lower}))`, and `\w(?i:\p{Lower})`, but not `A(?i:\p{Lower})`.
- - Using these properties case-insensitively is basically never done intentionally, so you're unlikely to encounter this error unless it's actually catching a mistake.
+ - Using these properties case-insensitively is basically never done intentionally, so you're unlikely to encounter this error unless it's catching a mistake.
## Similar projects
diff --git a/demo/index.html b/demo/index.html
index fa66ad8..1e292c5 100644
--- a/demo/index.html
+++ b/demo/index.html
@@ -59,12 +59,43 @@ Try it
- The output shows the result of calling toRegExp
. Oniguruma-To-ES includes functions to generate additional formats: compile
(returns an object with pattern
and flags
strings), toOnigurumaAst
, and toRegexAst
(for an AST based on regex
). You can run all of these from the console on this page. compile
and toRegExp
accept pattern and flags strings and an options object. toOnigurumaAst
and toRegexAst
accept a pattern and flags.
+ The output shows the result of calling toRegExp
. Oniguruma-To-ES includes functions to generate additional formats: compile
(returns an object with pattern
and flags
strings), toOnigurumaAst
, and toRegexAst
(for an AST based on regex
). You can run all of these from the console on this page. compile
and toRegExp
accept pattern and flags strings and an options object. toOnigurumaAst
and toRegexAst
accept a pattern and flags. You can also pass ASTs to printAst
.