We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 62b7f29 commit 5ede2beCopy full SHA for 5ede2be
app/server/beam/tau/lib/tau/hydra_synth_lang.ex
@@ -42,8 +42,19 @@ defmodule Tau.HydraSynthLang do
42
end)
43
44
def convert_global_syntax_to_instance(code_str) do
45
+ # Compile regexes at runtime
46
+ hydra_global_fns_regexp =
47
+ Enum.map(@hydra_global_fns_patterns, fn {el, pattern} ->
48
+ {el, Regex.compile!(pattern)}
49
+ end)
50
+
51
+ hydra_global_attrs_regexp =
52
+ Enum.map(@hydra_global_attrs_patterns, fn {el, pattern} ->
53
54
55
56
code_str =
- Enum.reduce(@hydra_global_fns_regexp, code_str, fn {el, regexp}, res ->
57
+ Enum.reduce(hydra_global_fns_regexp, code_str, fn {el, regexp}, res ->
58
String.replace(res, regexp, "hydra.#{el}(")
59
60
@@ -54,7 +65,7 @@ defmodule Tau.HydraSynthLang do
65
"({___time___})"
66
)
67
- Enum.reduce(@hydra_global_attrs_regexp, code_str, fn {el, regexp}, res ->
68
+ Enum.reduce(hydra_global_attrs_regexp, code_str, fn {el, regexp}, res ->
69
String.replace(res, regexp, "hydra.#{el}")
70
71
end
0 commit comments