handle parsing of unmapping and uncommanding

Mentioned in #16.
This commit is contained in:
Gokcehan 2016-10-16 21:23:24 +03:00
parent 5d0dfcde79
commit 5e2028e943

View File

@ -134,19 +134,31 @@ func (p *Parser) parseExpr() Expr {
result = &SetExpr{opt, val} result = &SetExpr{opt, val}
case "map": case "map":
var expr Expr
s.scan() s.scan()
keys := s.tok keys := s.tok
s.scan() s.scan()
expr := p.parseExpr() if s.typ != TokenSemicolon {
expr = p.parseExpr()
} else {
s.scan()
}
result = &MapExpr{keys, expr} result = &MapExpr{keys, expr}
case "cmd": case "cmd":
var expr Expr
s.scan() s.scan()
name := s.tok name := s.tok
s.scan() s.scan()
expr := p.parseExpr() if s.typ != TokenSemicolon {
expr = p.parseExpr()
} else {
s.scan()
}
result = &CmdExpr{name, expr} result = &CmdExpr{name, expr}
default: default: