From 119933b9b69d10791afc34fa5a05ca8f3178ca79 Mon Sep 17 00:00:00 2001 From: Tangent Wantwight Date: Mon, 20 Nov 2023 16:45:13 -0500 Subject: [PATCH] Disallow ] in toplevel bare words, not just in command substitutions Rationale: This differs from Tcl syntax, but means it's possible to recover a word knowing just its location in the source, without needing the surrounding context. --- src/parser.ts | 75 ++++++++++++++++++++++----------------------------- 1 file changed, 32 insertions(+), 43 deletions(-) diff --git a/src/parser.ts b/src/parser.ts index 88a7217..bec8ff9 100644 --- a/src/parser.ts +++ b/src/parser.ts @@ -15,8 +15,7 @@ const BackslashEscape = Sequence( Regex(/./y).expects("CHAR") ).map(([, [char]]) => ({ text: char })); -const BARE_WORD_CHAR = /[^\s\\;\[]+/y; -const BARE_BRACKET_WORD_CHAR = /[^\s\\;\[\]]+/y; +const BARE_WORD_CHAR = /[^\s\\;\[\]]+/y; let BracketScript: Pattern