From b028dc8407b8498f35327cfd19daba7771526750 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Sat, 23 Jan 2016 20:22:51 +0000 Subject: [PATCH] Simplify some return/break logic --- parse.go | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/parse.go b/parse.go index 81a01ecbf..6dadb9c5d 100644 --- a/parse.go +++ b/parse.go @@ -339,6 +339,7 @@ func (p *parser) command() { } p.want(DONE) case p.got(WORD): + args: for p.tok != EOF { lval := p.val switch { @@ -355,29 +356,29 @@ func (p *parser) command() { if p.got('&') { p.command() } - return + break args case p.got('|'): p.got('|') p.command() - return + break args case p.got('('): if !ident.MatchString(lval) { p.col -= utf8.RuneCountInString(lval) p.col-- p.lineErr("invalid func name %q", lval) - return + break args } p.want(')') p.command() - return + break args case p.got('>'): p.redirectDest() case p.got('<'): p.want(WORD) case p.got(';'): - return + break args case p.got('\n'): - return + break args default: p.errAfterStr("command") } @@ -395,19 +396,15 @@ func (p *parser) command() { if p.got('&') { p.command() } - return case p.got('|'): p.got('|') p.command() - return case p.got('>'): p.redirectDest() case p.got('<'): p.want(WORD) case p.got(';'): - return case p.got('\n'): - return default: p.errAfterStr("block") }