-
-
Notifications
You must be signed in to change notification settings - Fork 11
Syntax highlighting for shell heredoc is backward due to interference with rules for quotes #4715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I don't think this implies anything other than that the syntax highlighting in mcedit is not to be taken too seriously :) If you look at the source, you will find the following: https://github.com/MidnightCommander/mc/blob/master/misc/syntax/sh.syntax
This basically means that anything beginning with For reference, see how string literals ("") are handled below, and why the variables are highlighted there:
Writing The syntax definition language of mcedit is very restricted and is only meant to provide basic coloring, not proper language support, especially for complex languages. I don't think it's possible to express rules such as "something starting with '<<' and then letters, but eventually closing with the same letters" because, as far as I know, it doesn't have back references. Having said that, I think there are two ways to deal with the situation, other than you taking over maintenance of
I don't have a strong opinion either way. Obviously, Option 1 feels like a downgrade, especially since nobody has complained in 30 years, and does not necessarily make it any better. However, Option 2 has the limitation of still not supporting arbitrary heredoc delimiter tokens (which may be confusing if the common ones are handled more correctly). |
deja vu 😁 |
... and #2931 :( |
Signed-off-by: Yury V. Zaytsev <[email protected]>
I can't believe it myself, but it seems that I have found a hack to make it work in #4718! Could you guys please test it? |
The changes in the branch associated with this issue have been approved. |
Signed-off-by: Yury V. Zaytsev <[email protected]>
Signed-off-by: Yury V. Zaytsev <[email protected]>
Is there an existing issue for this?
Midnight Commander version and build configuration
Operating system
Linux localhost 6.10.2-x86_64-linode165 #1 SMP PREEMPT_DYNAMIC Tue Jul 30 15:03:21 EDT 2024 x86_64 GNU/Linux
Is this issue reproducible using the latest version of Midnight Commander?
How to reproduce
Use mcedit to open a file with this:
And you won't see the variable highlighted. This implies they aren't expanded. Which is false.
However open a file with this:
And you will see syntax highlighting. This implies they are expanded. But they aren't.
This is backwards!
Expected behavior
The opposite.
Actual behavior
See above.
Additional context
No response
The text was updated successfully, but these errors were encountered: