[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Handling extensions of programming languages
From: |
Harald Jörg |
Subject: |
Handling extensions of programming languages |
Date: |
Fri, 19 Mar 2021 19:53:54 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
Hello List,
today I'm looking for advice or hints how to deal with a task for CPerl
mode which might have been solved for other programming languages: How
to handle extensions of the language. That's not about user-defined
functions, but about extensions that change what needs to be included in
imenu, or which affect highlighting (cumbersome but straightforward) and
indentation (tricky).
* Is it a good idea to implement each of them as a minor mode which
only makes sense in CPerl mode buffers?
* Or should the extensions be loaded by a command from CPerl mode?
* Should that be one multi-file package or should each extension go
into a package of its own? Or even a mixture of both, to allow
contributions from ELPA and Non-GNU ELPA?
* Are there templates or conventions to follow (beyond the rules how
to build packages, I'm aware of these)?
Background: In Perl, adding new syntax to the language is easy enough so
that many developers have done this and published their work as
extension modules on CPAN. Some of these extensions have become very
popular, some are quite exotic. Occasionally they are competing with
each other for the same keywords, but with different syntax.
Eventually, popular keywords might make it into the Perl core, with yet
another syntax.
My first approach was to keep all the code in one place and evaluate all
the font-lock and indenting variables at runtime, as buffer-local
variables, for the different versions. This works to some extent for
highlightingq, but fails if an extension needs different logic for
indentation.
--
Cheers,
haj
- Handling extensions of programming languages,
Harald Jörg <=
- Re: Handling extensions of programming languages, Matt Armstrong, 2021/03/20
- Re: Handling extensions of programming languages, Harald Jörg, 2021/03/20
- Re: Handling extensions of programming languages, Clément Pit-Claudel, 2021/03/20
- Re: Handling extensions of programming languages, Harald Jörg, 2021/03/21
- Re: Handling extensions of programming languages, Stefan Monnier, 2021/03/21
- Re: Handling extensions of programming languages, Harald Jörg, 2021/03/21
- Re: Handling extensions of programming languages, Stefan Monnier, 2021/03/21
- Re: Handling extensions of programming languages (Perl), Harald Jörg, 2021/03/22
- Re: Handling extensions of programming languages (Perl), Stefan Monnier, 2021/03/22
- Re: Handling extensions of programming languages (Perl), Harald Jörg, 2021/03/22