broke lately
httpete opened this issue · comments
out of nowhere, we get
Error:unexpected type parsing primitive:token{Type:IDENT Literal
I am trying different versions , latest, master, newest version of go all same.
or we see unexpected bare identifier
I'm sorry to hear, I did rework the parser a fair bit in #114, but I've not seen anything break personally and I thought I'd been careful.
Do you have a (hopefully small) example that triggers the problem?
Actually now I wonder if it's this that is hitting you:
shell { name => "Echo Test",
command => "echo I'm Unix, probably.",
if => exists( /bin/ls ) }
Here the /bin/ls
causes an error as it is not quoted. I did make a note for myself, but it looks like I didn't address it.
I'll update the examples, but for you I wonder if quoting the arguments to exists
and similar might help?
I can't guess what you're doing, so without an example I'm struggling here. I did write this simple example using both let
and a contains
call:
let a = `ls`
log { message => "Logged here",
unless => contains("${a}", "passwd" ) }
So:
- Log a message, unless there's a file called
passwd
in this directory:
frodo ~/Repos/github.com/skx/marionette $ ./marionette test.in
2022/04/09 16:03:51 [USER] Logged here
frodo ~/Repos/github.com/skx/marionette $ touch passwd
frodo ~/Repos/github.com/skx/marionette $ ./marionette test.in
frodo ~/Repos/github.com/skx/marionette $
The only thing that I think has changed is the need to quote arguments to functions, but if that's not what it is I'm a little lost.
Change:
contains($a, "passwd" ) }
To :
contains("${a}", "passwd" ) }
And all will be well. I'm not sure the use of $blah
should be supported any more.