Packages: [Lua] "!=" not equal operator - syntax highlighting

Created on 9 Apr 2019  路  5Comments  路  Source: sublimehq/Packages

64c9e82b0d91d892730acfc872bc204c

I'm using the latest version of Sublime Text, with the default Lua syntax highlighter:
1f089783643a5fc7c5ab77e133363cc4

It was working just fine before the last update, so i don't know
Thanks!

Most helpful comment

For context, I believe I recommended you to post this issue here from a Reddit thread. In that Reddit thread you mention you use GLua. GLua is built on top of Lua. Among the allowable keywords are !=. But != is truly not a keyword in Lua:

$ lua5.3
Lua 5.3.3  Copyright (C) 1994-2016 Lua.org, PUC-Rio
> x = 1
> y = 2
> x != y
stdin:1: syntax error near '!'

There doesn't seem to be a GLua package on packagecontrol.io, so somebody should write it.

All 5 comments

The not-equal operator in lua is ~=.

For context, I believe I recommended you to post this issue here from a Reddit thread. In that Reddit thread you mention you use GLua. GLua is built on top of Lua. Among the allowable keywords are !=. But != is truly not a keyword in Lua:

$ lua5.3
Lua 5.3.3  Copyright (C) 1994-2016 Lua.org, PUC-Rio
> x = 1
> y = 2
> x != y
stdin:1: syntax error near '!'

There doesn't seem to be a GLua package on packagecontrol.io, so somebody should write it.

It looks like GLua adds a number of nonstandard operators, plus nonstandard comment syntaxes and a new keyword. We shouldn't add all of that to the core syntax, but merely adding != would not make the syntax work acceptably well for GLua.

It wouldn't be difficult to implement a third-party GLua syntax. If it were me, I'd use YAML Macros and write a small patch that can be applied to the core syntax; this would avoid copy-pasting the existing syntax.

If it were me, I'd use YAML Macros and write a small patch that can be applied to the core syntax; this would avoid copy-pasting the existing syntax.

Or in build 4xxx, the extends behaviour.

By the way, the syntax should not error out as much as it does in the gif at the top, so the issue should probably remaind open until that is fixed, but I firmly believe it is not a good idea to match !=.

Was this page helpful?
0 / 5 - 0 ratings