openwrt / packages

Community maintained packages for OpenWrt. Documentation for submitting pull requests is in CONTRIBUTING.md
GNU General Public License v2.0
3.96k stars 3.46k forks source link

nano: ucode syntax highlighting breaks when encountering "}}" #24325

Open eric-j-ason opened 3 months ago

eric-j-ason commented 3 months ago

Maintainer: @hnyman Environment: master

Syntax highlighting of ucode stops working when the string }} is encountered in the source code.

#! /usr/bin/env ucode

({a: {}});

// Everyting from here on gets the same color.
print("Hello!\n");
0 + 1 + 2 + 3 + 4 + 5;
return null;
bild
dave14305 commented 3 months ago

It’s working, but the use of a double }} triggers the template rule. If you separate them by a space, it should snap back to normal, no?

https://github.com/openwrt/packages/blob/4ef2b7e0fc3d0cb714e7522b8c9fc57185681560/utils/nano/files/ucode.nanorc#L44-L45

eric-j-ason commented 3 months ago

It’s working, but the use of a double }} triggers the template rule. If you separate them by a space, it should snap back to normal, no?

Indeed, that's my current workaround, but it's ugly and I don't want to have to do that! :) I'm not using templates at all.

dave14305 commented 3 months ago

Indeed, that's my current workaround, but it's ugly and I don't want to have to do that! :) I'm not using templates at all.

In that case, you could comment line 45 in /usr/share/nano/ucode.nanorc until someone smarter looks into the issue.