Title OptionParser silently swallows additional arguments
Priority bug Status resolved
Superseder Nosy List cedric, florian, jendrik, malte
Assigned To Keywords
Optional summary

Created on 2017-03-09.20:41:54 by florian, last changed by malte.

msg11178 (view) Author: malte Date: 2023-07-25.10:51:37
My understanding is that this bug has been fixed with the new option parser. Closing.
msg6961 (view) Author: malte Date: 2018-03-27.19:31:02
The option parser is currently very bad at error handling in general. Without
having looked at this precise issue in detail, I would recommend against trying
to patch the many holes in the error handling individually, hole by hole.

Instead, I think this is one of the cases where a complete reimplementation of
the text-handling side of things would be good, using a more principled parsing
approach based on tokenization and constructing syntax trees based on a formal
grammar. This is not particularly difficult, and I am happy to advise, but also
I think this is low priority.
msg6960 (view) Author: cedric Date: 2018-03-27.12:10:04
No astar(max([ff()], cea())) does not produce an error and silently swallows the
additional argument.
msg6959 (view) Author: florian Date: 2018-03-27.12:04:56
From the issue title it sounds like the problem was that the parser doesn't
complain if there are unused options left over at the end of parsing. As far as
I know we only fixed the parsing of lists to require explicit brackets around them.

So for example, would the following option also produce an error?
  astar(max([ff()], cea()))
msg6958 (view) Author: cedric Date: 2018-03-27.11:58:07
With the current master branch this is no longer true. If we run the following
command with missing brackets around the list, there will be a parse error.

./ ../benchmarks/blocks/probBLOCKS-4-0.pddl --search
"astar(max(ff(), cea()))"

parse error:                                   
expected list at:                              
Usage error occurred.
msg6165 (view) Author: florian Date: 2017-03-09.20:41:54
In the following call (which is missing the brackets around the list), the ff
heuristic is parsed as a positional argument and interpreted as a list of length
1. The additional argument "cea()" is ignored without warning.

./ ../benchmarks/blocks/probBLOCKS-4-0.pddl --search
"astar(max(ff(), cea()))"

This is related to issue507 but not quite the same (see msg6164).
Date User Action Args
2023-07-25 10:51:37maltesetstatus: chatting -> resolved
messages: + msg11178
2018-03-27 19:31:02maltesetmessages: + msg6961
2018-03-27 12:10:04cedricsetmessages: + msg6960
2018-03-27 12:04:56floriansetmessages: + msg6959
2018-03-27 11:58:07cedricsetstatus: unread -> chatting
nosy: + cedric
messages: + msg6958
2017-04-12 11:52:10jendriksettitle: OpenParser silently swallows additional arguments -> OptionParser silently swallows additional arguments
2017-03-09 20:41:54floriancreate