From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: 15874@debbugs.gnu.org, Bozhidar Batsov <bozhidar@batsov.com>
Subject: bug#15874: 24.3.50; exit! not properly font-locked in ruby-mode
Date: Thu, 05 Dec 2013 14:02:53 -0500 [thread overview]
Message-ID: <jwv8uvzdtb7.fsf-monnier+emacsbugs@gnu.org> (raw)
In-Reply-To: <529FF61B.4060709@yandex.ru> (Dmitry Gutov's message of "Thu, 05 Dec 2013 05:42:19 +0200")
>> Maybe a good way to handle them is via syntax-propertize,
> Huh yes, that's an approach I haven't considered.
The advantage is that it would also fix the sexp-movement operations.
> But it seems more performance-intensive than the other options, at
> least as long as Emacs regexps don't support lookbehind.
I don't see why we'd need lookbehind.
We can use a regexp like "\\(?:\\sw\\|\\s_\\)\\([!?]\\)" and then place
the syntax-table property on the ? (or !) character.
> Say, why don't we have a "non-symbol" matcher?
I'd rather do something a bit more generic, then, like a \\S which can
take a set of syntaxes to exclude. Or maybe extend the [:foo:]
character classes to allow [:sw:], [:s_:], etc... so we could do
[^[:sw:][:s_:]].
> I would think that in many cases the regexp engine performs
> unnecessary work when it sees "\\_<" or "\\_>" because we often know
> in advance that the character we've already matched, or will have to
> match next, is a symbol constituent. But the engine has to check.
It's not that big of a deal, tho. I doubt this would ever appear as
a noticeable slowdown. And with [^[:sw:][:s_:]] you'd have the extra
work of having to handle the EOB case, so you'd have
\(\'\|[^[:sw:][:s_:]]).
>> then, especially if we can come up with a good regexp that
>> distinguishes "method name" from "local variable name"?
> Not really. References to local variables, unlike instance and global ones,
> are indistinguishable from method calls if we judge only by name.
But you said that ! and ? are only allowed in method names. So somehow
Ruby's parser/lexer distinguishes the two cases. Would a reference to
a variable "foo?" simply always be parsed as "a reference to variable
foo?" which would later trigger an error because there's no such
variable (because there can't be any such variable)?
Stefan
next prev parent reply other threads:[~2013-12-05 19:02 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-12 12:38 bug#15874: 24.3.50; exit! not properly font-locked in ruby-mode Bozhidar Batsov
2013-12-04 18:31 ` Dmitry Gutov
2013-12-04 19:20 ` Stefan Monnier
2013-12-04 22:33 ` Dmitry Gutov
2013-12-04 23:15 ` Dmitry Gutov
2013-12-05 2:50 ` Stefan Monnier
2013-12-05 3:42 ` Dmitry Gutov
2013-12-05 19:02 ` Stefan Monnier [this message]
2013-12-06 2:44 ` Dmitry Gutov
2013-12-06 4:57 ` Stefan Monnier
2013-12-06 4:23 ` Dmitry Gutov
2013-12-05 6:34 ` Kevin Rodgers
2013-12-05 10:58 ` Dmitry Gutov
2013-12-05 14:50 ` Kevin Rodgers
2013-12-05 17:25 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwv8uvzdtb7.fsf-monnier+emacsbugs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=15874@debbugs.gnu.org \
--cc=bozhidar@batsov.com \
--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 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.