Open vnadot opened 1 year ago
So, after analyzing the iocsh parser, what happens is that # this is a comment
is not interpreted as a comment.
What happens is this:
dbpf("toto", "8", "#", "this", "is", "a", "comment")
But dbpf
doesn't look at arguments 3 to 7, so it gets ignored.
I'm kinda want to keep the current behavior, since you're using the parser to validate cmd files. We might want to discourage end of line comments to prevent accidents like these:
dbpf "toto" # somehow "#" is written into toto
@minijackson This probably indicates a bug in iocsh, could you raise it as an issue against epics-base please? The command parser knows how many arguments most iocsh commands expect (except for those which take a variable number using argc+argv), so maybe it should be displaying a warning or an error when it sees extraneous parameters for the commands it knows about? Alternatively it could allow trailing comments, but the #
character must start a new command parameter so this is not valid:
dbpf toto 8# this is not a comment
The dbpf
command there would be given the value string 8#
but the remaining parameters should raise that "extra parameters" warning/error first. I expect there to be discussion about whether it should be rejected as an error or just print a warning.
line:
tree-sitter message:
fix:
In my opinion, this should be allowed