From 28d18067853644430b9d352d9f969179f5b961ef Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Fri, 4 Nov 2016 09:45:11 +0000 Subject: [PATCH] Simplify JSON expression parsing --- sql/data.go | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/sql/data.go b/sql/data.go index abc63b54..fc16d2ea 100644 --- a/sql/data.go +++ b/sql/data.go @@ -105,13 +105,11 @@ func (p *parser) parseDiff() (exp []Expr, err error) { return nil, &ParseError{Found: lit, Expected: []string{"json"}} } - val, err := p.declare(tok, lit) + one.JSON, err = p.declare(tok, lit) if err != nil { return nil, &ParseError{Found: lit, Expected: []string{"json"}} } - one.JSON = val - exp = append(exp, one) return @@ -127,13 +125,11 @@ func (p *parser) parseMerge() (exp []Expr, err error) { return nil, &ParseError{Found: lit, Expected: []string{"json"}} } - val, err := p.declare(tok, lit) + one.JSON, err = p.declare(tok, lit) if err != nil { return nil, &ParseError{Found: lit, Expected: []string{"json"}} } - one.JSON = val - exp = append(exp, one) return @@ -149,13 +145,11 @@ func (p *parser) parseContent() (exp []Expr, err error) { return nil, &ParseError{Found: lit, Expected: []string{"json"}} } - val, err := p.declare(tok, lit) + one.JSON, err = p.declare(tok, lit) if err != nil { return nil, &ParseError{Found: lit, Expected: []string{"json"}} } - one.JSON = val - exp = append(exp, one) return