in reply to Re: Unicode infinity
in thread Unicode infinity
But, this is my point - right now the character is illegal in a perl script, and there's no reason (that I can guess, having not looked at perl's internals yet) that the language parser couldn't use that as a permitted character for numeric literals. It would be a little different from 'inf' in that it would be parsed as the constant rather than a lexical function that returns a constant, so like "-∞" would immediately become an NV, where "-inf" is a negation of a function call that hopefully gets resolved to an NV during compiler optimizations.
Edit
I mean exactly this :-)
$ git diff --cached diff --git a/toke.c b/toke.c index e6ff0c4f74..4590774e44 100644 --- a/toke.c +++ b/toke.c @@ -9174,6 +9174,13 @@ yyl_try(pTHX_ char *s) return tok; goto retry_bufptr; } + if (UTF && s + 2 < PL_bufend && *s == '\xE2' && s[1] == '\x88' + && s[2] == '\x9E') { + pl_yylval.opval = newSVOP(OP_CONST, 0, newSVnv(NV_INF)); + s += 3; + if (PL_expect == XOPERATOR) + no_op("Number",s); + TERM(THING); + } yyl_croak_unrecognised(aTHX_ s); case 4:
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Unicode infinity
by ikegami (Patriarch) on Jul 02, 2024 at 02:57 UTC | |
by NERDVANA (Priest) on Jul 02, 2024 at 05:02 UTC | |
by bliako (Abbot) on Jul 02, 2024 at 10:56 UTC | |
by Anonymous Monk on Jul 02, 2024 at 14:19 UTC | |
by bliako (Abbot) on Jul 02, 2024 at 18:50 UTC | |
by Anonymous Monk on Jul 02, 2024 at 14:26 UTC | |
| |
by NERDVANA (Priest) on Jul 02, 2024 at 20:17 UTC |