aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source')
-rw-r--r--stdlib/source/lux/compiler/default/syntax.lux25
-rw-r--r--stdlib/source/lux/data/text/regex.lux10
-rw-r--r--stdlib/source/lux/macro/poly.lux4
3 files changed, 7 insertions, 32 deletions
diff --git a/stdlib/source/lux/compiler/default/syntax.lux b/stdlib/source/lux/compiler/default/syntax.lux
index 89087d482..dc22de5d0 100644
--- a/stdlib/source/lux/compiler/default/syntax.lux
+++ b/stdlib/source/lux/compiler/default/syntax.lux
@@ -129,8 +129,6 @@
## Escaped character sequences follow the usual syntax of
## back-slash followed by a letter (e.g. \n).
-## Unicode escapes are possible, with hexadecimal sequences between 1
-## and 4 characters long (e.g. \u12aB).
## Escaped characters may show up in Char and Text literals.
(def: escaped-char^
(Lexer [Nat Text])
@@ -143,17 +141,6 @@
(^ (static ..text-delimiter)) (wrap [2 ..text-delimiter])
(^ (static ..escape)) (wrap [2 ..escape])
- ## Handle unicode escapes.
- "u"
- (do p.Monad<Parser>
- [code (l.between 1 4 l.hexadecimal)]
- (wrap (case (:: number.Hex@Codec<Text,Nat> decode code)
- (#.Right value)
- [("lux i64 +" 2 (text.size code)) (text.from-code value)]
-
- _
- (undefined))))
-
_
(p.fail (format "Invalid escaping syntax: " (%t code)))))))
@@ -634,18 +621,6 @@
_
(ex.throw invalid-escape-syntax [])))
- ## Handle unicode escapes.
- (^ (char "u"))
- (if (!i/< (:coerce Int end)
- (:coerce Int <escape-end>))
- (case (:: number.Hex@Codec<Text,Nat> decode (!clip <escape-start> <escape-end> source-code))
- (#error.Success value)
- (!find-next-escape 6 next-escape end source-code total (text.from-code value))
-
- (#error.Error error)
- (#error.Error error))
- (ex.throw invalid-escape-syntax []))
-
_
(ex.throw invalid-escape-syntax []))))))
diff --git a/stdlib/source/lux/data/text/regex.lux b/stdlib/source/lux/data/text/regex.lux
index a5409438e..e491873dc 100644
--- a/stdlib/source/lux/data/text/regex.lux
+++ b/stdlib/source/lux/data/text/regex.lux
@@ -7,7 +7,7 @@
["." product]
["e" error]
["." maybe]
- ["." number ("int/." Codec<Text,Int>)]
+ ["." number (#+ hex) ("int/." Codec<Text,Int>)]
[collection
["." list ("list/." Fold<List> Monad<List>)]]]
["." macro (#+ with-gensyms)
@@ -126,12 +126,12 @@
(def: ascii^
(l.Lexer Text)
- (l.range (char "\u0000") (char "\u007F")))
+ (l.range (hex "0") (hex "7F")))
(def: control^
(l.Lexer Text)
- (p.either (l.range (char "\u0000") (char "\u001F"))
- (l.one-of "\u007F")))
+ (p.either (l.range (hex "0") (hex "1F"))
+ (l.one-of (//.from-code (hex "7F")))))
(def: punct^
(l.Lexer Text)
@@ -144,7 +144,7 @@
(def: print^
(l.Lexer Text)
(p.either graph^
- (l.one-of "\u0020")))
+ (l.one-of (//.from-code (hex "20")))))
(def: re-system-class^
(l.Lexer Code)
diff --git a/stdlib/source/lux/macro/poly.lux b/stdlib/source/lux/macro/poly.lux
index 72a56b81d..7b3bc49a2 100644
--- a/stdlib/source/lux/macro/poly.lux
+++ b/stdlib/source/lux/macro/poly.lux
@@ -12,7 +12,7 @@
["." maybe]
[name ("name/." Codec<Text,Name>)]
["e" error]
- ["." number ("nat/." Codec<Text,Nat>)]
+ ["." number (#+ hex) ("nat/." Codec<Text,Nat>)]
["." text ("text/." Monoid<Text>)
format]
[collection
@@ -131,7 +131,7 @@
(def: (label idx)
(-> Nat Code)
- (code.local-identifier (text/compose "label\u0000" (nat/encode idx))))
+ (code.local-identifier ($_ text/compose "label" text.tab (nat/encode idx))))
(def: #export (with-extension type poly)
(All [a] (-> Type (Poly a) (Poly [Code a])))