Skip to content

Instantly share code, notes, and snippets.

@zoffixznet
Last active November 25, 2016 19:15
Show Gist options
  • Save zoffixznet/e0cc87a1dfd6006ba169f08b651fb9a0 to your computer and use it in GitHub Desktop.
Save zoffixznet/e0cc87a1dfd6006ba169f08b651fb9a0 to your computer and use it in GitHub Desktop.
# Perl 6 regex token to match \d+ but exclude any combinators:
# <[\x[30]..\x[39]\x[660]..\x[669]\x[6F0]..\x[6F9]\x[7C0]..\x[7C9]\x[966]..\x[96F]\x[9E6]..\x[9EF]\x[A66]..\x[A6F]\x[AE6]..\x[AEF]\x[B66]..\x[B6F]\x[BE6]..\x[BEF]\x[C66]..\x[C6F]\x[CE6]..\x[CEF]\x[D66]..\x[D6F]\x[DE6]..\x[DEF]\x[E50]..\x[E59]\x[ED0]..\x[ED9]\x[F20]..\x[F29]\x[1040]..\x[1049]\x[1090]..\x[1099]\x[17E0]..\x[17E9]\x[1810]..\x[1819]\x[1946]..\x[194F]\x[19D0]..\x[19D9]\x[1A80]..\x[1A89]\x[1A90]..\x[1A99]\x[1B50]..\x[1B59]\x[1BB0]..\x[1BB9]\x[1C40]..\x[1C49]\x[1C50]..\x[1C59]\x[A620]..\x[A629]\x[A8D0]..\x[A8D9]\x[A900]..\x[A909]\x[A9D0]..\x[A9D9]\x[A9F0]..\x[A9F9]\x[AA50]..\x[AA59]\x[ABF0]..\x[ABF9]\x[FF10]..\x[FF19]\x[104A0]..\x[104A9]\x[11066]..\x[1106F]\x[110F0]..\x[110F9]\x[11136]..\x[1113F]\x[111D0]..\x[111D9]\x[112F0]..\x[112F9]\x[11450]..\x[11459]\x[114D0]..\x[114D9]\x[11650]..\x[11659]\x[116C0]..\x[116C9]\x[11730]..\x[11739]\x[118E0]..\x[118E9]\x[11C50]..\x[11C59]\x[16A60]..\x[16A69]\x[16B50]..\x[16B59]\x[1D7CE]..\x[1D7FF]]>+
# Generate your own with:
put (
'<[',
|gather {
(^0x110000).grep({.uniprop eq "Nd"}).rotor(2 => -1)
.map: {
state @r;
.[0]+1 == .[1]
?? @r.push(.[0])
!! do {
@r.push(.[0]);
@r[0,*-1].grep(*.defined).map('\x[' ~ *.base(16) ~ ']')
.join('..').take;
@r = ();
}
}
},
']>+'
).join;
my token prop-Nd-only {
# All characters with 'Nd' unicode property
<[
\x[30]..\x[39]\x[660]..\x[669]\x[6F0]..\x[6F9]\x[7C0]..\x[7C9]
\x[966]..\x[96F]\x[9E6]..\x[9EF]\x[A66]..\x[A6F]\x[AE6]..\x[AEF]
\x[B66]..\x[B6F]\x[BE6]..\x[BEF]\x[C66]..\x[C6F]\x[CE6]..\x[CEF]
\x[D66]..\x[D6F]\x[DE6]..\x[DEF]\x[E50]..\x[E59]\x[ED0]..\x[ED9]
\x[F20]..\x[F29]\x[1040]..\x[1049]\x[1090]..\x[1099]
\x[17E0]..\x[17E9]\x[1810]..\x[1819]\x[1946]..\x[194F]
\x[19D0]..\x[19D9]\x[1A80]..\x[1A89]\x[1A90]..\x[1A99]
\x[1B50]..\x[1B59]\x[1BB0]..\x[1BB9]\x[1C40]..\x[1C49]
\x[1C50]..\x[1C59]\x[A620]..\x[A629]\x[A8D0]..\x[A8D9]
\x[A900]..\x[A909]\x[A9D0]..\x[A9D9]\x[A9F0]..\x[A9F9]
\x[AA50]..\x[AA59]\x[ABF0]..\x[ABF9]\x[FF10]..\x[FF19]
\x[104A0]..\x[104A9]\x[11066]..\x[1106F]\x[110F0]..\x[110F9]
\x[11136]..\x[1113F]\x[111D0]..\x[111D9]\x[112F0]..\x[112F9]
\x[11450]..\x[11459]\x[114D0]..\x[114D9]\x[11650]..\x[11659]
\x[116C0]..\x[116C9]\x[11730]..\x[11739]\x[118E0]..\x[118E9]
\x[11C50]..\x[11C59]\x[16A60]..\x[16A69]\x[16B50]..\x[16B59]
\x[1D7CE]..\x[1D7FF]
]>+
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment