[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#39277: 26.3; Tcl font lock does not understand quoting
From: |
Stefan Monnier |
Subject: |
bug#39277: 26.3; Tcl font lock does not understand quoting |
Date: |
Tue, 27 Oct 2020 09:27:45 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
>> Hello, tcl-mode's font lock (highlighting) chokes on this simple case:
>> puts {"hello}
>> where it considers the double quote inside the curly braces as a
>> "quoting" character.
>> I have confirmed it works with `emacs -Q`.
> there's some generic(?) syntactic font lock getting triggered once the
> doublequote character is found, that expects a closing doublequote - until
> then
> everything is locked as a string. Is this what this bug is about (it was not
> 100% clear to me from your initial report) ? i'm attaching a patch that works
> around this behavior but i don't know if it is the proper way to deal with the
> problem (it certainly doesn't look pretty).
It's been too long since I last had to deal with Tcl so I can't remember
the rules. The patch you submitted is most likely not "correct" in the
sense that it still leaves many cases that are mishandled.
Could someone remind me how " and {..} interact in Tcl?
E.g.
proc foo1 () {
puts "hello"
}
prints "hello" (without the quotes)?
And
proc foo2 () {
puts {"hello}
}
prints "hello (with the quote)?
And what about
proc foo3 () {
puts "hello}"
}
proc foo4 () {
puts "hello\}"
}
proc foo5 () {
puts "hello
}
> The idea is to insert an additional
> rule in tcl-syntax-propertize-function that will match the tcl-builtin-list
I'm thinking that maybe a better option is to catch all " in
tcl-syntax-propertize-function and for every one of them see if they're
"closing" a string and if not, check whether they're closed by a } before
a matching " and if so mark them as "not opening a string".
> + '("{\\([^}]+\\)}" 1 font-lock-string-face)
Won't this catch cases not usually considered as strings, like
proc foo5 () {
return 6
}
?
Stefan
- bug#39277: 26.3; Tcl font lock does not understand quoting, mvar, 2020/10/26
- bug#39277: (no subject), Lars Ingebrigtsen, 2020/10/27
- bug#39277: 26.3; Tcl font lock does not understand quoting, Andreas Schwab, 2020/10/27
- bug#39277: 26.3; Tcl font lock does not understand quoting,
Stefan Monnier <=
- bug#39277: 26.3; Tcl font lock does not understand quoting, Lars Ingebrigtsen, 2020/10/27
- bug#39277: 26.3; Tcl font lock does not understand quoting, mvar, 2020/10/27
- bug#39277: 26.3; Tcl font lock does not understand quoting, Lars Ingebrigtsen, 2020/10/27
- bug#39277: 26.3; Tcl font lock does not understand quoting, Stefan Monnier, 2020/10/27
- bug#39277: 26.3; Tcl font lock does not understand quoting, Stefan Monnier, 2020/10/29
- bug#39277: 26.3; Tcl font lock does not understand quoting, Lars Ingebrigtsen, 2020/10/30
- bug#39277: 26.3; Tcl font lock does not understand quoting, mvar, 2020/10/31
- bug#39277: 26.3; Tcl font lock does not understand quoting, Stefan Monnier, 2020/10/31