From 33ba4d5de3c37fd130370675e790395e06daf1be Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Tue, 8 Jan 2019 15:51:53 +0000 Subject: [PATCH] Enable using dollar symbol when defining a param variable --- sql/exprs.go | 13 +++++++++++++ sql/let.go | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/sql/exprs.go b/sql/exprs.go index bac0690d..bbbeaa75 100644 --- a/sql/exprs.go +++ b/sql/exprs.go @@ -149,6 +149,19 @@ func (p *parser) parseIdioms() (mul Idents, err error) { } +func (p *parser) parseParam() (*Ident, error) { + + _, lit, err := p.shouldBe(IDENT, PARAM) + if err != nil { + return nil, &ParseError{Found: lit, Expected: []string{"name"}} + } + + val, err := p.declare(IDENT, lit) + + return val.(*Ident), err + +} + // -------------------------------------------------- // // -------------------------------------------------- diff --git a/sql/let.go b/sql/let.go index 3e2f62c2..cf0e1ce8 100644 --- a/sql/let.go +++ b/sql/let.go @@ -26,7 +26,7 @@ func (p *parser) parseLetStatement() (stmt *LetStatement, err error) { // always be an identifier, specifying a // variable name to set. - stmt.Name, err = p.parseIdent() + stmt.Name, err = p.parseParam() if err != nil { return nil, err }