unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Using smie for Relax NG compact syntax
@ 2015-02-09 15:49 Nikolai Weibull
  2015-02-09 16:56 ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Nikolai Weibull @ 2015-02-09 15:49 UTC (permalink / raw)
  To: Emacs Users

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?



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-02-11 15:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-09 15:49 Using smie for Relax NG compact syntax Nikolai Weibull
2015-02-09 16:56 ` Stefan Monnier
2015-02-10  7:17   ` Nikolai Weibull
2015-02-10 20:13     ` Stefan Monnier
2015-02-11  7:55       ` Nikolai Weibull
2015-02-11 15:54         ` Stefan Monnier

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).