From: Dmitry Gutov <dgutov@yandex.ru>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: trunk r114534: Get Ruby's SMIE code to pass the test suite.
Date: Tue, 22 Oct 2013 02:30:05 +0400 [thread overview]
Message-ID: <5265AAED.5030202@yandex.ru> (raw)
In-Reply-To: <jwvob6i60fb.fsf-monnier+emacs@gnu.org>
On 21.10.2013 20:46, Stefan Monnier wrote:
>>> Maybe change the tokenizer so that a ".qux" *at smie-bolp* is tokenized
>>> as "." and "qux"?
>> That will probably break the following modified example:
>> class C
>> def foo
>> self
>> .end
>> D.new
>> .class
>> end
>> end
>
> Yes, the problem is that the set of desired indentation does not match
> the structure of a fixed parsing. So, some of the differences need to
> be handled in ad-hoc ways in the ruby-smie-rules function.
>
> E.g. for (:before . ".") we'd have to look at the previous token and if
> it's of the form "foo.bar", then manually align with the "." of
> "foo.bar".
Indentation is not the only problem there. Tokenizing ".end" as [".",
"end"] also breaks sexp movement and (for example)
`smie--matching-block-data'. The dot concatenation logic is the result
of you fixing that in revision 114545.
>> But I guess we can make the tokenizer both return "." as a separate
>> token and include it in the token that goes after it.
>
> I'm not sure I understand exactly what you're suggesting, but I'd
> venture to say that you can't do that.
I don't see why not. I've installed a patch along these lines in 114738,
and it fixes the existing examples. Unfortunately, it broke the more
complex situations:
foo do
bar
.tee
end
def bar
foo
.baz
end
...apparently because (goto-char (cadr (smie-indent--parent))), when
called before "." in these examples, brings point to the end of the
first line, and so (smie-rule-parent ruby-indent-level) returns a
surprising result.
Any suggestions what to do about that?
next prev parent reply other threads:[~2013-10-21 22:30 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <E1VSWj3-0005Os-CP@vcs.savannah.gnu.org>
2013-10-06 0:20 ` trunk r114534: Get Ruby's SMIE code to pass the test suite Dmitry Gutov
2013-10-06 16:45 ` Stefan Monnier
2013-10-06 21:40 ` Dmitry Gutov
2013-10-07 4:05 ` Stefan Monnier
2013-10-21 6:14 ` Dmitry Gutov
2013-10-21 12:46 ` Stefan Monnier
2013-10-21 14:16 ` Dmitry Gutov
2013-10-21 16:46 ` Stefan Monnier
2013-10-21 22:30 ` Dmitry Gutov [this message]
2013-10-22 15:46 ` Stefan Monnier
2013-10-22 15:47 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5265AAED.5030202@yandex.ru \
--to=dgutov@yandex.ru \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.