resholve icon indicating copy to clipboard operation
resholve copied to clipboard

Parsing error on &!

Open AndrewKvalheim opened this issue 3 years ago • 3 comments

zsh has a &! syntax for starting a disowned job, e.g.:

sleep 3s &!

Using this in a script causes resholve to fail with a parsing error:

$ resholve --interpreter "$SHELL" --path '' <<< 'sleep 3s &!'
  sleep 3s &!
             ^
[ stdinNone ]:2: error: Invalid word while parsing command

AndrewKvalheim avatar Aug 18 '22 18:08 AndrewKvalheim

This is expected (for now, at least). It's documented in the manpage (here's an excerpt from the plaintext copy):

https://github.com/abathur/resholve/blob/80e93633c824175e8afb25b0fa02aee35203e6fc/docs/resholve.1.txt#L202-L213

In the near-ish term, we can probably:

  • [ ] Use the documentation-generation capabilities added earlier this year to finally start generating the main README.md, which should make it easier to keep it (and other doc outputs) in sync on some questions like this.
  • [ ] Look into decorating parse errors that from the Oil/OSH parser with a little more context on this point.

In the long run I would like for resholve to be a little more parser-agnostic, but my gut says that'll be pretty difficult. I made some strides over the last year to build a more domain-specific abstraction layer between resholve and the OSH parser, but it is still tightly coupled to some of Oil's abstractions and APIs.

abathur avatar Aug 18 '22 19:08 abathur

Thanks, makes sense. Indeed, I’d only been looking at the main and nixpkgs readmes. For now I’ll just use a wrapper around resholve to temporarily replace &! with @AMPERSAND_EXCLAMATION@.

AndrewKvalheim avatar Aug 18 '22 21:08 AndrewKvalheim

Good point--if pluggable parsers don't seem to be tractable, I guess pluggable in/out filters might be...

abathur avatar Aug 18 '22 22:08 abathur