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.

6 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
7
votes
0answers
774 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 ...
7
votes
2answers
669 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\...
2
votes
0answers
149 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 ...
1
vote
0answers
23 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 ...
0
votes
0answers
12 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 ...
0
votes
0answers
10 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 ...