aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/langs.md4
-rw-r--r--docs/paths.md2
-rw-r--r--environment.c8
-rw-r--r--examples/tomodeps/tomodeps.tm4
-rw-r--r--test/lang.tm4
-rw-r--r--typecheck.c2
6 files changed, 12 insertions, 12 deletions
diff --git a/docs/langs.md b/docs/langs.md
index 7e1bd7ef..0eecb3cd 100644
--- a/docs/langs.md
+++ b/docs/langs.md
@@ -18,7 +18,7 @@ lang HTML:
$/"/: "&quot",
$/'/: "'",
})
- return HTML.from_unsafe_text(t)
+ return HTML.without_escaping(t)
func paragraph(content:HTML)->HTML:
return $HTML"<p>$content</p>"
@@ -75,7 +75,7 @@ instead of building a global function called `execute()` that takes a
```tomo
lang Sh:
func escape(text:Text)->Sh:
- return Sh.from_unsafe_text("'" ++ text:replace($/'/, "''") ++ "'")
+ return Sh.without_escaping("'" ++ text:replace($/'/, "''") ++ "'")
func execute(sh:Sh)->Text:
...
diff --git a/docs/paths.md b/docs/paths.md
index f53cc971..b1f03fff 100644
--- a/docs/paths.md
+++ b/docs/paths.md
@@ -33,7 +33,7 @@ not be trustworthy and interpret that value as a single path component name,
i.e. the name of a directory or file. If a user were to supply a value like
`..` or `foo/baz`, it would risk navigating into a directory other than
intended. Paths can be created from text with slashes using
-`Path.from_unsafe_text(text)` if you need to use arbitrary text as a file path.
+`Path.without_escaping(text)` if you need to use arbitrary text as a file path.
## Path Methods
diff --git a/environment.c b/environment.c
index 385e27b5..0232781d 100644
--- a/environment.c
+++ b/environment.c
@@ -318,7 +318,7 @@ env_t *new_compilation_unit(CORD *libname)
{"from_c_string", "Text$from_str", "func(str:CString)->Text"},
{"from_codepoint_names", "Text$from_codepoint_names", "func(codepoint_names:[Text])->Text"},
{"from_codepoints", "Text$from_codepoints", "func(codepoints:[Int32])->Text"},
- {"from_unsafe_text", "Path$cleanup", "func(text:Text)->Path"},
+ {"without_escaping", "Path$cleanup", "func(text:Text)->Path"},
{"has", "Text$has", "func(text:Text, pattern:Pattern)->Bool"},
{"join", "Text$join", "func(glue:Text, pieces:[Text])->Text"},
{"lines", "Text$lines", "func(text:Text)->[Text]"},
@@ -381,18 +381,18 @@ env_t *new_compilation_unit(CORD *libname)
}
- set_binding(namespace_env(env, "Shell"), "from_unsafe_text",
+ set_binding(namespace_env(env, "Shell"), "without_escaping",
new(binding_t, .type=Type(FunctionType, .args=new(arg_t, .name="text", .type=TEXT_TYPE),
.ret=Type(TextType, .lang="Shell", .env=namespace_env(env, "Shell"))),
.code="(Shell_t)"));
- set_binding(namespace_env(env, "Path"), "from_unsafe_text",
+ set_binding(namespace_env(env, "Path"), "without_escaping",
new(binding_t, .type=Type(FunctionType, .args=new(arg_t, .name="text", .type=TEXT_TYPE),
.ret=Type(TextType, .lang="Path", .env=namespace_env(env, "Path"))),
.code="Path$cleanup"));
- set_binding(namespace_env(env, "Pattern"), "from_unsafe_text",
+ set_binding(namespace_env(env, "Pattern"), "without_escaping",
new(binding_t, .type=Type(FunctionType, .args=new(arg_t, .name="text", .type=TEXT_TYPE),
.ret=Type(TextType, .lang="Pattern", .env=namespace_env(env, "Pattern"))),
.code="(Pattern_t)"));
diff --git a/examples/tomodeps/tomodeps.tm b/examples/tomodeps/tomodeps.tm
index 1cd2ee59..9418ba6f 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.from_unsafe_text(line:replace($/use {..}/, "\1")):resolved(relative_to=file)
+ file_import := Path.without_escaping(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.from_unsafe_text(arg):resolved()
+ path := Path.without_escaping(arg):resolved()
dependencies := get_dependency_graph(File(path))
draw_tree(File(path), dependencies)
else if arg:matches($/{id}/):
diff --git a/test/lang.tm b/test/lang.tm
index e19c1e2a..9a05eb11 100644
--- a/test/lang.tm
+++ b/test/lang.tm
@@ -9,10 +9,10 @@ lang HTML:
$/'/: "&#39;",
})
- return HTML.from_unsafe_text(t)
+ return HTML.without_escaping(t)
func escape_int(i:Int)->HTML:
- return HTML.from_unsafe_text("$i")
+ return HTML.without_escaping("$i")
func paragraph(content:HTML)->HTML:
return $HTML"<p>$content</p>"
diff --git a/typecheck.c b/typecheck.c
index 82eecce7..afeac420 100644
--- a/typecheck.c
+++ b/typecheck.c
@@ -365,7 +365,7 @@ void bind_statement(env_t *env, ast_t *statement)
type_t *type = Type(TextType, .lang=def->name, .env=ns_env);
Table$str_set(env->types, def->name, type);
- set_binding(ns_env, "from_unsafe_text",
+ set_binding(ns_env, "without_escaping",
new(binding_t, .type=Type(FunctionType, .args=new(arg_t, .name="text", .type=TEXT_TYPE), .ret=type),
.code=CORD_all("(", namespace_prefix(env->libname, env->namespace), def->name, "_t)")));