bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#10460: 24.0.92; css-mode sexp movement


From: Stefan Monnier
Subject: bug#10460: 24.0.92; css-mode sexp movement
Date: Mon, 29 Dec 2014 14:13:55 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

> I suppose this supplies a bit of wiggle room, if you leniently interpret
> "prefix characters".

SMIE interprets "balanced expression" as "a subnode in the AST".

It can surprise at the beginning, indeed, but in my experience, it's
a useful generalization for languages with infix syntax.

Of course, for infix languages, "a + b * c" might be a proper AST
subnode (whereas stopping after "a + b" wouldn't if there's a "* c"
afterwards), but so is "a", when using forward-sexp we have to choose at
which level of the AST we want to jump forward.  In the above case SMIE
will choose "a" over "a + b * c" (i.e. it will choose the
smallest/deepest subnode).

But when faced with "+ b * c", there is simply no proper subnode ahead.
Here, SMIE extends yet again the concept of "balanced expression" in
order to be able to do something meaningful: it jumps over the whole "+
b * c" (i.e. over the infix op plus its right argument).  This is very
handy in languages with few parentheses, letting you advance by "large"
logical units, just like you would in Lisp where every top-level
statement is wrapped inside parentheses.


        Stefan





reply via email to

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