diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-03-06 14:21:30 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-03-06 14:21:30 +0200 |
commit | ec2247ead804e7cde1fe6a0f0b8112440e80a61c (patch) | |
tree | 1c8fb52317c5f013ec7797d355c388433f3f8b0a | |
parent | 4da38e50a096e9aa19a75149bcc9dbb6e1de901e (diff) |
Only recognize function call if lparen is unseparated
-rw-r--r-- | build2/parser.cxx | 5 | ||||
-rw-r--r-- | 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 |