From: Stephen Dolan Date: Sun, 2 Dec 2012 22:22:08 +0000 (+0000) Subject: Fix a horrible scoping/associativity bug. X-Git-Tag: jq-1.2~29 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=63d10433c9e92028d5b6acda47119bde998eae1f;p=jq Fix a horrible scoping/associativity bug. `1 as $x | . | $x` didn't compile, as it was parsed as (1 as $x | .) | $x where `$x` is undefined, rather than as 1 as $x | (. | $x) --- diff --git a/parser.y b/parser.y index 59d535e..9c23450 100644 --- a/parser.y +++ b/parser.y @@ -75,7 +75,7 @@ struct lexer_param; /* revolting hack */ %left ';' -%left '|' +%right '|' %left ',' %right "//" %nonassoc '=' SETPIPE SETPLUS SETMINUS SETMULT SETDIV SETDEFINEDOR diff --git a/testdata b/testdata index 1bab84f..e6fcaaf 100644 --- a/testdata +++ b/testdata @@ -146,6 +146,10 @@ null [6] [7] +42 as $x | . | . | . + 432 | $x + 1 +34324 +43 + 1 as $x | [$x,$x,$x as $x | $x] null [1,1,1]