[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Using smie for Relax NG compact syntax
From: |
Nikolai Weibull |
Subject: |
Using smie for Relax NG compact syntax |
Date: |
Mon, 9 Feb 2015 16:49:30 +0100 |
Hi!
I’m trying to set up a grammar for Relax NG’s compact syntax and am
trying to get something as simple as
element a {
empty
}
to work, but I’m not succeeding:
(unless rnc-mode-syntax-table
(setq rnc-mode-syntax-table (make-syntax-table))
(modify-syntax-entry ?\{ "(}" rnc-mode-syntax-table)
(modify-syntax-entry ?\} "){" rnc-mode-syntax-table))
(defconst rnc-mode-smie-grammar
(smie-prec2->grammar
(smie-bnf->prec2
'((id)
(pattern ("element" id "{" pattern "}") ("empty"))))))
and
(defun rnc-mode-smie-rules (kind token)
(pcase (cons kind token)
(`(:elem .basic) rnc-indent-level)))
rnc-mode-smie-forward-token and rnc-mode-smie-backward-token are
basically smie-default-forward-token and smie-default-backward-token.
The indentation after a { at the end of a line doesn’t agree with the
rules at all and I can’t understand why. The keyword “element” is
being highlighted as show-paren-mismatch, which I also don’t
understand, as there’s a whole pattern in
element a {
empty
}
Any obvious issues here?
- Using smie for Relax NG compact syntax,
Nikolai Weibull <=