aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/documentation/lux/data/text/escape.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/documentation/lux/data/text/escape.lux')
-rw-r--r--stdlib/source/documentation/lux/data/text/escape.lux40
1 files changed, 40 insertions, 0 deletions
diff --git a/stdlib/source/documentation/lux/data/text/escape.lux b/stdlib/source/documentation/lux/data/text/escape.lux
new file mode 100644
index 000000000..e9c8637fb
--- /dev/null
+++ b/stdlib/source/documentation/lux/data/text/escape.lux
@@ -0,0 +1,40 @@
+(.module:
+ [library
+ [lux #*
+ ["$" documentation (#+ documentation:)]
+ [data
+ [text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.escaped
+ "Yields a escaped version of the text."
+ [(escaped text)])
+
+(documentation: /.un_escaped
+ (format "Yields an un-escaped text."
+ \n "Fails if it was improperly escaped.")
+ [(un_escaped text)])
+
+(documentation: /.literal
+ "If given a escaped text literal, expands to an un-escaped version."
+ [(/.literal "Line 1\nLine 2")
+ "=>"
+ (format "Line 1" \n
+ "Line 2")])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..escaped
+ ..un_escaped
+ ..literal
+ ($.default /.escapable?)
+ ($.default /.dangling_escape)
+ ($.default /.invalid_escape)
+ ($.default /.invalid_unicode_escape)]
+ []))