unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stephen Leake <stephen_leake@stephe-leake.org>
To: emacs-devel <emacs-devel@gnu.org>
Subject: Re: Font Locking issue: Need help/advice
Date: Fri, 03 Apr 2020 16:21:46 -0800	[thread overview]
Message-ID: <86y2rccd7p.fsf@stephe-leake.org> (raw)
In-Reply-To: <IGsIxAzWP4TeIh99ut4oHe5AZC4nW8tGGDswRA3gtZElrmHHO9eqrwEi7ZN32sFbDqFbRfOzn7eH87ThDRP734-lR3z3G40JbSr1LqZv778=@protonmail.ch> (Serghei's message of "Fri, 03 Apr 2020 22:20:31 +0000")

Serghei <egrep@protonmail.ch> 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	other threads:[~2020-04-04  0:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-03 12:29 Font Locking issue: Need help/advice Serghei Iakovlev
2020-04-03 18:27 ` Stephen Leake
2020-04-03 22:20   ` Serghei
2020-04-04  0:21     ` Stephen Leake [this message]
2020-04-03 22:36 ` David Engster
2020-04-03 23:48   ` Yuan Fu
2020-04-05 14:37   ` Serghei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86y2rccd7p.fsf@stephe-leake.org \
    --to=stephen_leake@stephe-leake.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).