From 0c9a53567cf6e43c89446d1809c89223374f048a Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Sun, 6 Oct 2024 07:07:08 -0400 Subject: [tnslc] escape from inside parens --- tnslc/parse/ast.tnsl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tnslc/parse') 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) -- cgit v1.2.3