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)



On Sat, 11 Jan 2020 at 15:30, Roman Perepelitsa
<roman.perepelitsa@xxxxxxxxx> wrote:
> Thanks, this is the hint I needed . $token at zsd-detect.main:325 is
> always a word in the command position, right?

Yes. As I've added some commits recently I'll link the line of code so
that the reference will be safe:

https://github.com/zdharma/zshelldoc/blob/ccba867/src/zsd-detect.main#L318

> 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 would also add:

array=(
  x y z
)

> 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.

I hope that I've could help. I think that what's practically useful is
the TOKEN_TYPES array that's taken from z-sy-h/f-sy-h and extended,
and its way of use to decide on the state change that the parser
should undergo.


--
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org



Messages sorted by: Reverse Date, Date, Thread, Author