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
1
vote
0answers
11 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
27 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 ...
7
votes
2answers
635 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\...
1
vote
3answers
57 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
81 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
2answers
201 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 ...
18
votes
2answers
638 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
133 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
248 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 ...
3
votes
1answer
159 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 ...
8
votes
0answers
702 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
331 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. ...
5
votes
1answer
277 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 ...