summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2024-10-06 07:07:08 -0400
committerKyle Gunger <kgunger12@gmail.com>2024-10-06 07:07:08 -0400
commit0c9a53567cf6e43c89446d1809c89223374f048a (patch)
tree0ad7935fddb71dd019cc738a06802c63a81c1a26
parent7824a4709a306d48893f88ec586b6f50bfdde875 (diff)
[tnslc] escape from inside parens
-rw-r--r--tnslc/parse/ast.tnsl19
1 files changed, 19 insertions, 0 deletions
diff --git a/tnslc/parse/ast.tnsl b/tnslc/parse/ast.tnsl
index d70d755..71185f4 100644
--- a/tnslc/parse/ast.tnsl
+++ b/tnslc/parse/ast.tnsl
@@ -1336,7 +1336,26 @@ struct Node {
;/
/; _mhf_escape (~utils.File fin, ~Node mod, ~Token first, ~Node cur)
+ int deep = 0
+ /; loop (bool run = true; run == true && first`._type !== TTYPE_ERR)
+ /; if (first`.eq(")\0") == true)
+ /; if (deep > 0)
+ deep = deep - 1
+ ;; else if (cur`.eq("(\0") == false)
+ cur = cur`.parent
+ ;/
+
+ /; if (cur`.eq("(\0") == false)
+ run = false;
+ ;/
+ ;; else if (first`.eq("(\0") == true)
+ deep = deep + 1
+ ;/
+ Token tmp = produce_next_token(fin, first`)
+ first`.end()
+ first` = tmp
+ ;/
;/
/; _mhf_finish_value (~utils.File fin, ~Node mod, ~Token first, ~Node cur)