Questions tagged [smie]

SMIE (Simple Minded Indentation Engine) is a package that provides a generic navigation and indentation engine. Based on a very simple parser using an “operator precedence grammar”, it lets major modes extend the sexp-based navigation of Lisp to non-Lisp languages as well as provide a simple to use but reliable auto-indentation.

Filter by
Sorted by
Tagged with
0 votes
0 answers
43 views

SMIE: defining a build.ninja grammar

I'm trying to write a mode in SMIE, to figure out how it works and to create some documentation. build.ninja (a build system used by Meson and others) is a perfect candidate due to its very simple ...
Hi-Angel's user avatar
  • 544
0 votes
1 answer
50 views

SMIE precedence conflict

(defvar foo-smie-grammar (smie-prec2->grammar (smie-bnf->prec2 '((exp (exp "+" exp) (exp "*" exp) ("let" let-decls "in" exp)) (let-decls (let-decls ";" let-...
Michael Norrish's user avatar
0 votes
1 answer
96 views

SMIE and backward-up-list

Though SMIE seems to be indenting my little language very nicely, and forward-sexp also works well, I don't get backward-up-list working as desired. My grammar: (defvar holscript-smie-grammar (...
Michael Norrish's user avatar
1 vote
0 answers
60 views

How does SMIE mode determine what the parent of a token is?

I'm writing indentation rules for a custom mode using SMIE. I want to use smie-rule-parent-p to have different behavior for indenting an empty line depending on context, so inside my indentation ...
Tikhon Jelvis's user avatar
1 vote
1 answer
62 views

How can I get SMIE to not treat keywords as parentheses?

I'm writing an SMIE-based mode for a language that has type definitions that look like this: type Foo = { foo : Int, bar : String } One problem I'm running into is that type and = are treated as ...
Tikhon Jelvis's user avatar
1 vote
3 answers
356 views

SMIE Indenting Arguments and Blocks

This is closely related to a previous question I asked here: SMIE Basic Identation and Block Example However, it is sufficiently different (and already big enough) that I might as well ask it as a ...
Xaldew's user avatar
  • 1,181
3 votes
2 answers
360 views

SMIE Basic Identation and Block Example

I've tried for a while to create a simple major mode that uses SMIE to perform navigation and indentation, but it seems like even the simple examples that I've found seems to break quite easily. The ...
Xaldew's user avatar
  • 1,181
7 votes
1 answer
392 views

what are the options to write a language grammar for a new major mode?

I am writing a major mode for a programming language that has a well-defined grammar: it has a BNF, formalised in some happy files. I don't particularly want to re-implement the BNF as a series of ...
fommil's user avatar
  • 1,760
3 votes
0 answers
177 views

SMIE default syntax : First level of indentation

When you only do that in your major mode : (require 'smie) (smie-setup nil #'ignore) That means SMIE but no grammar, and no rules. And it's great. It makes the point stay on col0 when you TAB and ...
yPhil's user avatar
  • 963
23 votes
3 answers
1k views

Is there any SMIE documentation that is clear?

I've spent many, many hours now trying to get any sort of SMIE indentation rule/grammar/thing working. Are there any examples of a small, toy or skeleton SMIE-based mode with documentation on how it ...
Nagora's user avatar
  • 373
3 votes
1 answer
463 views

How to control line-continuation using SMIE?

I'm trying to implement qmake-mode using SMIE(https://www.gnu.org/software/emacs/manual/html_node/elisp/SMIE.html), but I have no idea how to control indent width in line-continuation. Block ...
Chan's user avatar
  • 33
2 votes
1 answer
184 views

Using SMIE for language without comment syntax

I'm making a major mode for json (which has no comments), and using SMIE for 'free' indenting. I've currently got a half-baked grammar called json-grammar, and no rules-function. Consequently, I'm ...
Squidly's user avatar
  • 1,499
7 votes
0 answers
1k views

How do I parse a simple grammar and obtain a syntax tree in Emacs lisp?

How can I construct a parse tree from a string and a simple grammar? Semantic seems very tricky, and SMIE does not seem to produce a parse tree. Here's an example, assuming a language that looks like ...
Clément's user avatar
  • 3,953
7 votes
2 answers
814 views

Do not align nested calls when using ruby-smie

When using the newly added ruby formatting functionality I face the following problem: I would really like for my rspec code to be formatted like the following: it do is_expected.to match(/\[Error\...
Renan Ranelli's user avatar
7 votes
1 answer
442 views

Parsing parentheses: smie vs syntax table

I am maintaining a mode for a programming language with... let's say "annoying" syntax constructs. For example, the angle brackets (no idea if it is the correct word) < and > are parentheses. ...
T. Verron's user avatar
  • 4,253
5 votes
1 answer
442 views

Some warnings and unexpected indentation with SMIE

I'm trying SMIE to describe the Nix language. Unfortunately when I use it, I have the following problems: There are 4 messages saying: Warning (smie): token } is both closer and neither. Which I do ...
Damien Cassou's user avatar