aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/base64/base64.tm4
-rw-r--r--examples/colorful/README.md2
-rw-r--r--examples/colorful/colorful.tm14
-rw-r--r--examples/tomodeps/tomodeps.tm4
4 files changed, 12 insertions, 12 deletions
diff --git a/examples/base64/base64.tm b/examples/base64/base64.tm
index 4e4cc8b1..fadfed20 100644
--- a/examples/base64/base64.tm
+++ b/examples/base64/base64.tm
@@ -59,7 +59,7 @@ lang Base64:
output[dest+2] = _EQUAL_BYTE
output[dest+3] = _EQUAL_BYTE
- return Base64.without_escaping(Text.from_bytes(output[]) or return none)
+ return Base64.from_text(Text.from_bytes(output[]) or return none)
func decode_text(b64:Base64 -> Text?):
return Text.from_bytes(b64:decode_bytes() or return none)
@@ -90,7 +90,7 @@ lang Base64:
func main(input=(/dev/stdin), decode=no):
if decode:
- b := Base64.without_escaping(input:read()!)
+ b := Base64.from_text(input:read()!)
say(b:decode_text()!)
else:
text := input:read()!
diff --git a/examples/colorful/README.md b/examples/colorful/README.md
index e0572bac..5f6ef8a4 100644
--- a/examples/colorful/README.md
+++ b/examples/colorful/README.md
@@ -76,7 +76,7 @@ lang Markdown:
$/*{..}*/="@(i:\1)",
$/[?](?)/="@(blue,underline:\1)",
})
- return Colorful.without_escaping(text)
+ return Colorful.from_text(text)
func colorful(md:Markdown -> Colorful):
return $Colorful"$md"
diff --git a/examples/colorful/colorful.tm b/examples/colorful/colorful.tm
index bcc95eb8..e5baf4ac 100644
--- a/examples/colorful/colorful.tm
+++ b/examples/colorful/colorful.tm
@@ -9,10 +9,10 @@ CSI := "$\033["
lang Colorful:
convert(text:Text -> Colorful):
text = text:replace_all({$/@/="@(at)", $/(/="@(lparen)", $/)/="@(rparen)"})
- return Colorful.without_escaping(text)
+ return Colorful.from_text(text)
- convert(i:Int -> Colorful): return Colorful.without_escaping("$i")
- convert(n:Num -> Colorful): return Colorful.without_escaping("$n")
+ convert(i:Int -> Colorful): return Colorful.from_text("$i")
+ convert(n:Num -> Colorful): return Colorful.from_text("$n")
func for_terminal(c:Colorful -> Text):
return CSI ++ "m" ++ _for_terminal(c, _TermState())
@@ -23,7 +23,7 @@ lang Colorful:
func main(texts:[Text], files=[:Path], by_line=no):
for i,text in texts:
- colorful := Colorful.without_escaping(text)
+ colorful := Colorful.from_text(text)
colorful:print(newline=no)
if i == texts.length: say("")
else: say(" ", newline=no)
@@ -34,10 +34,10 @@ func main(texts:[Text], files=[:Path], by_line=no):
for file in files:
if by_line:
for line in file:by_line() or exit("Could not read file: $(file.text)"):
- colorful := Colorful.without_escaping(line)
+ colorful := Colorful.from_text(line)
colorful:print()
else:
- colorful := Colorful.without_escaping(file:read() or exit("Could not read file: $(file.text)"))
+ colorful := Colorful.from_text(file:read() or exit("Could not read file: $(file.text)"))
colorful:print(newline=no)
@@ -169,7 +169,7 @@ func _add_ansi_sequences(text:Text, prev_state:_TermState -> Text):
else if text == "@" or text == "at": return "@"
parts := (
text:matches($/{0+..}:{0+..}/) or
- return "@("++_for_terminal(Colorful.without_escaping(text), prev_state)++")"
+ return "@("++_for_terminal(Colorful.from_text(text), prev_state)++")"
)
attributes := parts[1]:split($/{0+space},{0+space}/)
new_state := prev_state
diff --git a/examples/tomodeps/tomodeps.tm b/examples/tomodeps/tomodeps.tm
index 48c026e9..93e3eb42 100644
--- a/examples/tomodeps/tomodeps.tm
+++ b/examples/tomodeps/tomodeps.tm
@@ -18,7 +18,7 @@ func _get_file_dependencies(file:Path -> {Dependency}):
if lines := file:by_line():
for line in lines:
if line:matches($/use {..}.tm/):
- file_import := Path.without_escaping(line:replace($/use {..}/, "\1")):resolved(relative_to=file)
+ file_import := Path.from_text(line:replace($/use {..}/, "\1")):resolved(relative_to=file)
deps:add(Dependency.File(file_import))
else if line:matches($/use {id}/):
module_name := line:replace($/use {..}/, "\1")
@@ -103,7 +103,7 @@ func main(files:[Text]):
for arg in files:
if arg:matches($/{..}.tm/):
- path := Path.without_escaping(arg):resolved()
+ path := Path.from_text(arg):resolved()
dependencies := get_dependency_graph(File(path))
draw_tree(File(path), dependencies)
else if arg:matches($/{id}/):