Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: z-sy-h and z-asug: zle-line-pre-redraw, POSTDISPLAY, coexistence (was: Re: emulate bash key bindings)
[moving ericdfreese@xxxxxxxxx to bcc as this isn't related to
zsh-autosuggestions]
On Sat, Jan 11, 2020 at 12:46 AM Sebastian Gniazdowski
<sgniazdowski@xxxxxxxxx> wrote:
> Yes, it contains the code to extract the commands and also function
> bodies from Zsh source. The code responsible for this starts at line
> 186 of src/zsd-detect.main. The place in code to get the command is
> line 325 of the file.
Thanks, this is the hint I needed . $token at zsd-detect.main:325 is
always a word in the command position, right?
I'm looking for a parser that's a bit more precise. Here are a few
examples of zsh code I want to be handled correctly:
2>&1 x
x <<END
y
END
for x ( ; ) y
case x in
a) y;;
b)
esac
I also need alias expansion. For example, given this setup:
alias a='1> ' # note the trailing space
alias b='/dev/null x'
alias x=y
alias c=';'
The parser should give me `x` when parsing `a b c d` because after
alias expansion `a b c d` becomes this:
1> /dev/null y c d
The parser needs to be fast as I'm going to be calling it from zle. It
shouldn't perform I/O (no file globbing) and must not have side
effects. These constraints mean that correct parsing is impossible to
implement. For example, there is no way to figure out what `*` does .
I'm OK with it. Given the choice between false positives (parser says
something is a command when it isn't) and false negatives (parser
misses a command), I would prefer false positives.
I'm not asking you (or anyone else) to build this for me. Just sharing
to provide context.
Roman.
- References:
- emulate bash key bindings
- Re: emulate bash key bindings
- Re: emulate bash key bindings
- Re: emulate bash key bindings
- Re: emulate bash key bindings
- Re: emulate bash key bindings
- Re: emulate bash key bindings
- Re: emulate bash key bindings
- z-sy-h and z-asug: zle-line-pre-redraw, POSTDISPLAY, coexistence (was: Re: emulate bash key bindings)
- Re: z-sy-h and z-asug: zle-line-pre-redraw, POSTDISPLAY, coexistence (was: Re: emulate bash key bindings)
- Re: z-sy-h and z-asug: zle-line-pre-redraw, POSTDISPLAY, coexistence (was: Re: emulate bash key bindings)
- Re: z-sy-h and z-asug: zle-line-pre-redraw, POSTDISPLAY, coexistence (was: Re: emulate bash key bindings)
- Re: z-sy-h and z-asug: zle-line-pre-redraw, POSTDISPLAY, coexistence (was: Re: emulate bash key bindings)
- From: Sebastian Gniazdowski
- Re: z-sy-h and z-asug: zle-line-pre-redraw, POSTDISPLAY, coexistence (was: Re: emulate bash key bindings)
- Re: z-sy-h and z-asug: zle-line-pre-redraw, POSTDISPLAY, coexistence (was: Re: emulate bash key bindings)
- From: Sebastian Gniazdowski
Messages sorted by:
Reverse Date,
Date,
Thread,
Author