From e81efe570ffb03dbe59ade0b39de30019a0e8930 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Wed, 31 Jul 2024 23:10:39 +0100 Subject: [PATCH] syntax: use Parser.matched consistently It's the same behavior, but the code becomes more consistent. While here, make DebugPrint always finish the output with a newline. --- syntax/parser.go | 3 +-- syntax/walk.go | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/syntax/parser.go b/syntax/parser.go index 59a45b18..2a2ae910 100644 --- a/syntax/parser.go +++ b/syntax/parser.go @@ -1359,8 +1359,7 @@ func (p *Parser) paramExp() *ParamExp { p.curErr("not a valid parameter expansion operator: %v", p.tok) } p.quote = old - pe.Rbrace = p.pos - p.matched(pe.Dollar, dollBrace, rightBrace) + pe.Rbrace = p.matched(pe.Dollar, dollBrace, rightBrace) return pe } diff --git a/syntax/walk.go b/syntax/walk.go index 27fdcb1b..85d66924 100644 --- a/syntax/walk.go +++ b/syntax/walk.go @@ -235,6 +235,7 @@ func Walk(node Node, f func(Node) bool) { func DebugPrint(w io.Writer, node Node) error { p := debugPrinter{out: w} p.print(reflect.ValueOf(node)) + p.printf("\n") return p.err }