[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: SMIE examples or guides
From: |
Stefan Monnier |
Subject: |
Re: SMIE examples or guides |
Date: |
Wed, 29 Jun 2016 03:37:26 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) |
> HELLO
> HELLO foo BYE
> HELLO
> bla
> net
> neat
> BYE
> text more
> more
> BYE
That's expected: the third HELLO...BYE is indented as an argument of
the first. Similarly to:
(table->method)
(arg1,
arg2
)
[ Read the above, thinking that "(" is like HELLO and ")" is like
"BYE". ]
Similarly, "net" and "neat" are treated as arguments to "bla".
A quick fix to that part would be to add an indentation rule along the
lines of
(`(:elem . arg) 0)
or alternatively
(`(:list-intro . ,_) t)
Tho, if your language makes newlines significant (i.e. "bla\nnet" is not
equivalent to "bla net"), then you might be better off changing the
tokenizer (by providing appropriate :forward-token and :backward-token
arguments to `smie-setup') so as to return an actual token for every
newline encountered, after which you can add corresponding rules to
the grammar.
> HELLO
> bla
> net
> neat
> BYE
To get the BYE indented this way, a quick-fix could be to add a rule
like
(`(:before . "BYE") 4)
-- Stefan
- SMIE examples or guides, Björn Lindqvist, 2016/06/18
- Re: SMIE examples or guides, Stefan Monnier, 2016/06/19
- Re: SMIE examples or guides, Björn Lindqvist, 2016/06/26
- Re: SMIE examples or guides, Stefan Monnier, 2016/06/27
- Re: SMIE examples or guides, Björn Lindqvist, 2016/06/27
- Re: SMIE examples or guides, Stefan Monnier, 2016/06/27
- Re: SMIE examples or guides, Björn Lindqvist, 2016/06/28
- Re: SMIE examples or guides, Stefan Monnier, 2016/06/28
- Re: SMIE examples or guides, Björn Lindqvist, 2016/06/28
- Re: SMIE examples or guides,
Stefan Monnier <=
- Re: SMIE examples or guides, Björn Lindqvist, 2016/06/29
- Re: SMIE examples or guides, Stefan Monnier, 2016/06/30
- Re: SMIE examples or guides, Björn Lindqvist, 2016/06/30
- Re: SMIE examples or guides, Stefan Monnier, 2016/06/30
- Re: SMIE examples or guides, Björn Lindqvist, 2016/06/30