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
1answer
20 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-...
0
votes
0answers
14 views

SMIE: bare opener forces “hanging” indent

If I use the default SML mode parser, or other SMIE parsers, and have a rule for if-then-else as an expression form, I get reasonable indentation of x + if p then q else ...
7
votes
2answers
676 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\...
0
votes
0answers
11 views

smie handling of expression prefixes inside its s-expressions

In the SMIE implementation of SML, ! is given the "expression prefix" syntax class. This seems to lead to a strange tokenization, such that its notion of s-expression (e.g.,if-then-else blocks) gets ...
0
votes
1answer
60 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 (...
1
vote
0answers
24 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 ...
1
vote
1answer
34 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 ...
1
vote
3answers
112 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 ...
3
votes
2answers
127 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 ...
7
votes
1answer
251 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 ...
19
votes
2answers
721 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 ...
2
votes
0answers
151 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 ...
3
votes
1answer
282 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 ...
2
votes
1answer
169 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 ...
7
votes
0answers
775 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 ...
6
votes
1answer
355 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. ...
4
votes
1answer
288 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 ...