From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: 15594@debbugs.gnu.org
Subject: bug#15594: trunk r114639: * lisp/progmodes/ruby-mode.el (ruby-smie-grammar): Add rule for paren-free
Date: Mon, 14 Oct 2013 23:31:15 -0400 [thread overview]
Message-ID: <jwvfvs3nro2.fsf-monnier+emacsbugs@gnu.org> (raw)
In-Reply-To: <525C9926.9030202@yandex.ru> (Dmitry Gutov's message of "Tue, 15 Oct 2013 04:23:50 +0300")
> No, space is significant(++),
I guess we're lucky.
> I'm not suggesting to revert the addition of
> the " @ " token. But we need a better predicate in
> ruby-smie--args-separator-p' to check that the thing after POS is probably
> an argument. "Starts with a word character" is too narrow.
> How would that look?
> (unless (member (save-excursion (ruby-smie--forward-token) '("]" "}" "end"
> "+" "-" "?" ":" ...)))
(looking-at "\\s)\\|\\s.") ?
> Or should the check be more like "is the next token in `ruby-smie-grammar',
> and if yes, is its left priority more than ' @ 's right priority"?
Calling ruby-smie--forward-token is a bit dangerous since that function
might itself be called from ruby-smie--forward-token. It might work,
but you'll have to think hard about why an inf-loop is not possible.
> You've probably already found this, but on the off chance you haven't,
> here's its syntax in (incomplete, somewhat outdated, etc) BNF form:
> http://www.cse.buffalo.edu/~regan/cse305/RubyBNF.pdf
Please add this URL in a comment somewhere near ruby-smie-grammar (for
example).
>> +# Shouldn't "bar" be aligned with "foo"? --Stef
>> if foo &&
>> bar
>> end
> Maybe. Either option would be better than the current behavior. I've picked
> this one because the old engine indents it like so, and additional
> indentation of 2 (compared to the if body) would likely be more useful that
> 1, when reading the code.
Getting `foo' and `bar' aligned is just a matter of adding && to the set
of infix operators (i.e. completing the table of infix operators).
Getting `bar' to be indented one more than `foo' here but not in other
cases of "foo && \n bar" would require more work.
Stefan
next prev parent reply other threads:[~2013-10-15 3:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <E1VV5za-0006lz-QY@vcs.savannah.gnu.org>
2013-10-14 2:06 ` bug#15594: trunk r114639: * lisp/progmodes/ruby-mode.el (ruby-smie-grammar): Add rule for paren-free Dmitry Gutov
[not found] ` <87a9icobbl.fsf@yandex.ru>
2013-10-14 13:44 ` Stefan Monnier
[not found] ` <jwv38o4otsk.fsf-monnier+emacsbugs@gnu.org>
2013-10-15 1:23 ` Dmitry Gutov
2013-10-15 3:31 ` Stefan Monnier [this message]
2013-10-21 6:02 ` Dmitry Gutov
2013-10-21 13:25 ` Stefan Monnier
2013-10-26 1:19 ` Dmitry Gutov
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvfvs3nro2.fsf-monnier+emacsbugs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=15594@debbugs.gnu.org \
--cc=dgutov@yandex.ru \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).