On Tue, Oct 6, 2009 at 5:51 AM, heatsink <[email protected]> wrote:
>
> I'm experimenting with Yi as a way of making my project's data files
> easier to edit.  However, I'm having a hard time of it.  I hope you
> don't mind if I post beginner questions to this thread.

You're very welcome.

> I started by making a mode.  My first improvement was to set modeHL to
> an Alex-based lexer that generates a list of tokens.  Lexer errors
> cause yi to abort, which is somewhat undesirable.  How can I avoid
> that?

Unfortunately, this requires modifying the vty-based UI code. We need to
evaluate the screen to display (force the data structure) and catch
any exception
raised. Please understand however that the lexer shouldn't error out, even
with this mechanism in place. It is also rather easy to make sure the lexer
never errors out, by having a 1-character catch-all token at the end.

> Then, I wrote a modeGetStrokes that takes a token and returns a stroke
> for it.  However, only the token at the most recently edited point
> gets colored.  What should I do to apply syntax highlighting to an
> entire buffer?

Make sure to use the pattern of another token-based mode. (eg. pythonMode
in Modes.hs)

Cheers,
JP.

--~--~---------~--~----~------------~-------~--~----~
Yi development mailing list
[email protected]
http://groups.google.com/group/yi-devel
-~----------~----~----~----~------~----~------~--~---

Reply via email to