unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: mvar <mvar.40k@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: mvar <mvar.40k@gmail.com>, Lars Ingebrigtsen <larsi@gnus.org>,
	39277-done@debbugs.gnu.org
Subject: bug#39277: 26.3; Tcl font lock does not understand quoting
Date: Tue, 03 Nov 2020 21:47:53 +0200	[thread overview]
Message-ID: <87k0v2w7bq.fsf@cnu407c2zx.nsn-intra.net> (raw)
In-Reply-To: <jwvmu027d43.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sat, 31 Oct 2020 09:20:12 -0400")

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> The original case is solved
>> (although the enclosed {"string} is not font-locked as string but I
>> wouldn't consider it an error)
>
> Yes, this is a separate problem and I can't see how to fix it: since
> "everything's a string" in Tcl, it's really not clear what
> `font-lock-string-face` should apply to and what it shouldn't apply to.
>
> The current design is to use it only where "..." is used.  When the code
> is fully under your control it lets you choose (to some extent at least)
> what is highlighted and what is not (by choosing "..." vs {...}), but
> clearly it won't be "right" in all cases.
>
>> plus it fixes the following:
>>
>>     proc foo4 () {
>>        puts "hello}"
>>     }
>>
>> this was marked as valid before your changes but tclsh won't accept it
>> as such - the bracket } inside the string needs to be escaped when
>> inside a proc context (but as a plain statement there's no such
>> requirement).
>
> Indeed.
>

hi again,

i stumbled upon a not-so-rare case where this fix breaks a previously
valid syntax locking. Example:

set a "Testing: [split "192.168.1.1/24" "/"] address"

the closing ] is marked as unmatched (no matching parenthesis found)

notice how the above statement is evaluated by tclsh/wish:

% set a "Testing: [split "192.168.1.1/24" "/"] address"
Testing: 192.168.1.1 24 address
% 

the problem with the unmatched ] can only(?) be solved by escaping both
inner "strings"

set a "Testing: [split \"192.168.1.1/24\" \"/\"] address"

but then this is evaluated into an array

% set a "Testing: [split \"192.168.1.1/24\" \"/\"] address"
Testing: {} 192.168.1.1 24 {} address

i still consider the previously applied fix as an overall improvement,
so perhaps i should open a new bug report for this problem? btw i tried
to come up with some fix but i'm still a looong way from grasping those
syntax & parsing mechanisms (syntax-ppss and friends)


thanks,
Michalis





  reply	other threads:[~2020-11-03 19:47 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-25 10:00 bug#39277: 26.3; Tcl font lock does not understand quoting Hadrien Lacour
2020-01-25 10:12 ` bug#39277: tcl-mode " Hadrien Lacour
2020-01-25 10:53 ` Hadrien Lacour
2020-10-26 20:44 ` bug#39277: 26.3; Tcl font lock " mvar
2020-10-27  8:31   ` bug#39277: (no subject) Lars Ingebrigtsen
2020-10-27  8:51   ` bug#39277: 26.3; Tcl font lock does not understand quoting Andreas Schwab
2020-10-27  8:56     ` Lars Ingebrigtsen
2020-10-27 13:27   ` Stefan Monnier
2020-10-27 17:45     ` Lars Ingebrigtsen
2020-10-27 20:42       ` mvar
2020-10-27 20:47         ` Lars Ingebrigtsen
2020-10-27 22:48         ` Stefan Monnier
2020-10-29 17:39           ` Stefan Monnier
2020-10-30 12:02             ` Lars Ingebrigtsen
2020-10-31 11:01             ` mvar
2020-10-31 13:20               ` Stefan Monnier
2020-11-03 19:47                 ` mvar [this message]
2020-11-03 21:45                   ` Stefan Monnier
2020-11-05 12:38                     ` mvar
2020-10-27 15:24 ` bug#39277: Hadrien Lacour

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=87k0v2w7bq.fsf@cnu407c2zx.nsn-intra.net \
    --to=mvar.40k@gmail.com \
    --cc=39277-done@debbugs.gnu.org \
    --cc=larsi@gnus.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 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).