vile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vile] Rust syntax highlighting


From: Thomas Dickey
Subject: Re: [vile] Rust syntax highlighting
Date: Sun, 5 Nov 2017 14:03:05 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

On Sun, Nov 05, 2017 at 06:37:07PM +0100, Paul van Tilburg wrote:
> Hey,
> 
> Sorry for spam posting! I will stop now :P

no problem :-)
 
> On Sun, Nov 05, 2017 at 06:29:16PM +0100, Paul van Tilburg wrote:
> > On Sun, Nov 05, 2017 at 10:46:22AM -0500, Thomas Dickey wrote:
> > > ----- Original Message -----
> > > | From: "Paul van Tilburg" <address@hidden>
> > > | For Rust I have found this:
> > > | https://doc.rust-lang.org/book/first-edition/syntax-index.html
> > > | 
> > > | Which is part of the "first book", which is more describes everything
> > > | feature by feature and also provides snippets per syntactal thing.
> > > | (In contrast to the "second book", which is much more like a book
> > > | that explains everything as a whole.)
> > > 
> > > I see.  The quoting in the "other syntax" would be most of the work: in
> > > a quick read I see that they're using "'" (single-quote) in more than one
> > > way.
> > 
> > Yes, AFAIK it's used for character literals ('c'), and as a prefix for
> > lifetime anotations ('static, 'a).  Hmm, that might a bit problematic.

Also a "b'" prefix.

yes - sometimes those different things can be accommodated using lex's
states, and sometimes not.

> > I've run into the reference:
> > https://doc.rust-lang.org/reference/lexical-structure.html
> > and the grammer
> > https://doc.rust-lang.org/grammar.html
> > in the meantime.  So, I will go through that.
> 
> And then there is also this:
> https://github.com/rust-lang/gedit-config/blob/master/share/gtksourceview-3.0/language-specs/rust.lang
> 
> I wonder if these GtkSourceView language files can be translated
> into something vile can use (besides the keyword lists),
> as they seem somewhat similar.  We would be able to bring more
> language definitions to vile if that were the case.

I suppose so (if there were a tool to translate those into lex).
That looks like a hybrid of lex/yacc (in xml format of course).
Most of the regular expressions can be used as is in lex...

vile's using just lex with states, because in editing the text
is often incorrect at the level where yacc would see it.

You might get some insight by seeing how the single-quote is
handled for the different cases.

-- 
Thomas E. Dickey <address@hidden>
https://invisible-island.net
ftp://ftp.invisible-island.net

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]