From ec2247ead804e7cde1fe6a0f0b8112440e80a61c Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 6 Mar 2017 14:21:30 +0200 Subject: Only recognize function call if lparen is unseparated --- build2/parser.cxx | 5 ++++- unit-tests/function/syntax.test | 4 +--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/build2/parser.cxx b/build2/parser.cxx index a5ed0d5..412b557 100644 --- a/build2/parser.cxx +++ b/build2/parser.cxx @@ -2793,7 +2793,10 @@ namespace build2 // tt = peek (); - if (tt == type::lparen) + // Note that we require function call opening paren to be + // unseparated; consider: $x ($x == 'foo' ? 'FOO' : 'BAR'). + // + if (tt == type::lparen && !peeked ().separated) { // Function call. // diff --git a/unit-tests/function/syntax.test b/unit-tests/function/syntax.test index 0e4462e..bce00e7 100644 --- a/unit-tests/function/syntax.test +++ b/unit-tests/function/syntax.test @@ -4,14 +4,12 @@ $* <'$dump()' >:'' : none $* <'$dump( )' >:'' : none-in-spaces -$* <'$dump ()' >:'' : none-out-spaces $* <'$dump("")' >'{}' : one-empty $* <'$dump(a)' >'a' : one-single $* <'$dump(a b c)' >'a b c' : one-list $* <'$dump(d/t{x y z})' >'d/t{x} d/t{y} d/t{z}' : one-names -$* <'print a$dummy1 ([string] b)c' >'abc' : concat - +$* <'print a$dummy1([string] b)c' >'abc' : concat $* <'print $dummy2([uint64] 123, [uint64] 321)' >'444' : multi-arg : quoting -- cgit v1.1