emacs-devel
[Top][All Lists]
Advanced

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

Re: Font Locking issue: Need help/advice


From: Stephen Leake
Subject: Re: Font Locking issue: Need help/advice
Date: Fri, 03 Apr 2020 16:21:46 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (windows-nt)

Serghei <address@hidden> writes:

> Hello Stephen,
>
>> > I am creating a new mode called zephir-mode [1]. The main goals of
>> > this mode is to provide syntax highlighting, indentation, movement,
>> > navigation support and Imenu for Zephir 2 language.
>>
>> The ELPA package wisi can help here (I'm the author).
>
> In this case users will have to run an external process, right?

They will have to run ~/.emacs.d/elpa/ada-mode-i.jj/build.sh and
install.sh manually when the package is installed; that requires an Ada
compiler, and manual installation a compiler vendor library (the Debian
packages are _not_ adequate, as of last month). That's fine for people
who are already using Ada; it is a pretty high bar for others.

(now that I've actually said that in an email, I realize I might be able
to improve it some).

Actually running the process is transparent.

> This is a little worrying for me. I would prefer to use the built-in
> functionality for as long as possible. Partly due to the fact that
> users are reluctant (and not always successful) installs new software.

At one time, wisi supported an elisp-only option. But I did not want to
implement error correction in the elisp parser; it was hard enough in
Ada. So the elisp was dropped.

The built-in package semantic provides a parser generator and run-time
in elisp. That parser does not do error correction, so the results are
less than satisfactory.

>> > I'd like to provide the patterns I'm trying to catch:
>> > protected foo;
>> > protected static foo;
>> > public bar = 1;
>> > private baz = [];
>> > private baz = [] { set };
>> > protectd foo { get };
>> > public static bar = 42;
>> > private static baz = 13 { get };
>> > private baz = 13 { get, set, toString };
>>
>> This definitely would be easier with a parser.
>
>
> Of course, any LR(k) parser can handle this.  But what about SMIE?
> Won't it be more organic?

I tried SMIE for Ada; it proved inadequate, since in Ada you always have
to parse the whole file. For just the code you show here, SMIE should be
ok. And since it focusses on local parsing, it should be pretty
error-tolerant.

eglot (https://github.com/joaotavora/eglot) is an option, if there is an
existing LSP server for your language (or for a similar-enough
language). At some point, I'd like to allow wisi to use an LSP server as
the parser.

-- 
-- Stephe



reply via email to

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