diff --git a/syntax/lexer.go b/syntax/lexer.go index fa1469711..b3daba6d3 100644 --- a/syntax/lexer.go +++ b/syntax/lexer.go @@ -317,6 +317,7 @@ skipSpace: } else { p.tok = rightParen p.quote = noState + p.rune() // we are tokenizing manually } default: // including '(', '|' p.advanceLitRe(r) diff --git a/syntax/printer_test.go b/syntax/printer_test.go index 1b948d009..4e361a7b5 100644 --- a/syntax/printer_test.go +++ b/syntax/printer_test.go @@ -374,6 +374,7 @@ var printTests = []printCase{ samePrint("case a in b) [[ x =~ y ]] ;; esac"), samePrint("case a in b) [[ a =~ b$ || c =~ d$ ]] ;; esac"), samePrint("case a in b) [[ a =~ (b) ]] ;; esac"), + samePrint("[[ (a =~ b$) ]]"), { "a=(\nb\nc\n) b=c", "a=(\n\tb\n\tc\n) b=c",