[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ELPA] New package: bnf-mode
From: |
Stefan Monnier |
Subject: |
Re: [ELPA] New package: bnf-mode |
Date: |
Sat, 04 May 2019 14:35:21 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
> I created a major mode for editing BNF grammars [1] and would like to
> add this package to the ELPA [2]. Currently it provides basic syntax
> and font-locking for BNF files. BNF notation is supported exactly
> form as it was first announced in the ALGOL 60 report. EBNF and ABNF
> are not supported but in my plans for the near future.
In what kind of circumstances would this be used?
I've seen BNF-like syntax used by various tools (like bison and
friends, for example), but never with this particular syntax.
;; Basically `syntax-propertize-function' is a construct which belongs
;; to `font-lock'.
No. It's used by font-lock (as well as various other things), but it
does not belong to it.
;; But correct indentation depends on
;; syntax properties of the text, and that should ideally be
;; independent of font-lock being activated or not.
Which is why syntax-propertize was created (as opposed to the previous
font-lock-syntactic-keywords, which *did* belong to font-lock and
suffered from the problem you describe).
;; For `bnf-mode', this means that with `font-lock' disabled, we wont
;; have our syntax properties set correctly, and indentation will
;; suffer.
That's not true.
;; To patch our way around this, we issue a `syntax-propertize' call
;; manually, `font-lock' enabled or not.
(with-silent-modifications
(when bnf-mode-algol-comments-style
(funcall syntax-propertize-function (point-min) (point-max))))
Don't do that: syntax-propertize-function will be called when needed
(e.g. by indent-according-to-mode).
Stefan
- [ELPA] New package: bnf-mode, Serghei, 2019/05/04
- Re: [ELPA] New package: bnf-mode,
Stefan Monnier <=
- Message not available
- Re: [ELPA] New package: bnf-mode, Serghei Iakovlev, 2019/05/05
- Re: [ELPA] New package: bnf-mode, Stefan Monnier, 2019/05/05
- Re: [ELPA] New package: bnf-mode, John Yates, 2019/05/05
- RE: [ELPA] New package: bnf-mode, Drew Adams, 2019/05/05
- RE: [ELPA] New package: bnf-mode, Drew Adams, 2019/05/05
- RE: [ELPA] New package: bnf-mode, Serghei Iakovlev, 2019/05/06
- Re: [ELPA] New package: bnf-mode, Stefan Monnier, 2019/05/06
- Re: [ELPA] New package: bnf-mode, Serghei Iakovlev, 2019/05/06
- Re: [ELPA] New package: bnf-mode, Stefan Monnier, 2019/05/06