From e1764c3da2cbc6046e9eab10d3b69d03840313ca Mon Sep 17 00:00:00 2001 From: Peter Ahrens Date: Mon, 4 Oct 2021 18:00:31 -0400 Subject: [PATCH] parse unicode forall and exists as identifiers (#42314) Co-authored-by: Steven G. Johnson --- NEWS.md | 1 + src/flisp/julia_extensions.c | 3 ++- test/syntax.jl | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 32f5dba76ea3f..a8473aa026675 100644 --- a/NEWS.md +++ b/NEWS.md @@ -12,6 +12,7 @@ New language features to enforce the involved function calls to be (or not to be) inlined. ([#41312]) * The default behavior of observing `@inbounds` declarations is now an option via `auto` in `--check-bounds=yes|no|auto` ([#41551]) * New function `eachsplit(str)` for iteratively performing `split(str)`. +* `∀`, `∃`, and `∄` are now allowed as identifier characters ([#42314]). Language changes ---------------- diff --git a/src/flisp/julia_extensions.c b/src/flisp/julia_extensions.c index dbe94e1388069..e4bb731355eb8 100644 --- a/src/flisp/julia_extensions.c +++ b/src/flisp/julia_extensions.c @@ -82,9 +82,10 @@ static int is_wc_cat_id_start(uint32_t wc, utf8proc_category_t cat) wc == 0x223f || wc == 0x22be || wc == 0x22bf || // ∿, ⊾, ⊿ wc == 0x22a4 || wc == 0x22a5 || // ⊤ ⊥ - (wc >= 0x2202 && wc <= 0x2233 && + (wc >= 0x2200 && wc <= 0x2233 && (wc == 0x2202 || wc == 0x2205 || wc == 0x2206 || // ∂, ∅, ∆ wc == 0x2207 || wc == 0x220e || wc == 0x220f || // ∇, ∎, ∏ + wc == 0x2200 || wc == 0x2203 || wc == 0x2204 || // ∀, ∃, ∄ wc == 0x2210 || wc == 0x2211 || // ∐, ∑ wc == 0x221e || wc == 0x221f || // ∞, ∟ wc >= 0x222b)) || // ∫, ∬, ∭, ∮, ∯, ∰, ∱, ∲, ∳ diff --git a/test/syntax.jl b/test/syntax.jl index 14b17d6eaa0b2..ecfc703635c29 100644 --- a/test/syntax.jl +++ b/test/syntax.jl @@ -2967,6 +2967,12 @@ end @generated g25678(x) = return :x @test g25678(7) === 7 +# issue #19012 +@test Meta.parse("\U2200", raise=false) == Symbol("∀") +@test Meta.parse("\U2203", raise=false) == Symbol("∃") +@test Meta.parse("a\U2203", raise=false) == Symbol("a∃") +@test Meta.parse("\U2204", raise=false) == Symbol("∄") + # issue 42220 macro m42220() return quote