From f13c6b47124f8de1cad3744989b4ac3806d431d4 Mon Sep 17 00:00:00 2001 From: Christian De la Hoz Date: Tue, 31 Aug 2021 20:33:28 +0200 Subject: [PATCH] assignments with ':=' when the variable has only been declared --- corpus/plpgsql/block.txt | 6 ++++++ grammar.js | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/corpus/plpgsql/block.txt b/corpus/plpgsql/block.txt index 86c3f38..dc176bf 100644 --- a/corpus/plpgsql/block.txt +++ b/corpus/plpgsql/block.txt @@ -147,6 +147,7 @@ DO $$ BEGIN SELECT 1; foo.bar = lower(foo.baz); + foo.bar := lower(foo.baz); RETURN 2; END $$; @@ -165,6 +166,11 @@ $$; (function_call (identifier) (identifier))) + (assign_statement + (identifier) + (function_call + (identifier) + (identifier))) (return_statement (number))) (dollar_quote)))) diff --git a/grammar.js b/grammar.js index 24878df..cf0c447 100644 --- a/grammar.js +++ b/grammar.js @@ -459,7 +459,7 @@ module.exports = grammar({ optional($.execute_using), ), execute_using: $ => seq(kw("using"), commaSep1($._value_expression)), - assign_statement: $ => seq($.identifier, "=", $._value_expression), + assign_statement: $ => seq($.identifier, choice("=", ":="), $._value_expression), return_statement: $ => seq(kw("return"), choice( seq(kw("query"), $.select_statement), seq(kw("query"), $.execute_statement),