[Top][All Lists]

[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


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 {

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
       (pattern ("element" id "{" pattern "}") ("empty"))))))


(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 {

Any obvious issues here?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]