Lua lexer

All questions regarding lexer highlighting schemes are discussed here...
Post Reply
ANewUser
Posts: 50
Joined: 25.01.2020 12:15

Lua lexer

Post by ANewUser »

Hello!

The goto statement and the label definition (::labelname::) are missing. https://www.lua.org/manual/5.3/manual.html#3.3.4
The "table.member" and "table:member" references before and after the function keyword is not recognized. https://i.imgur.com/zXqJQPn.png
The metamethods

Code: Select all

__add,__band,__bnot,__bor,__bxor,__call,__concat,__div,__eq,__gc,__idiv,__index,__ipairs,__le,__len,__lt,__metatable,__mod,__mode,__mul,__newindex,__pairs,__pow,__shl,__shr,__sub,__tostring,__unm
are not highlighted. http://lua-users.org/wiki/MetatableEvents
Different style for the core functions, constants

Code: Select all

assert(),collectgarbage(),dofile(),error(),getmetatable(),ipairs(),load(),loadfile(),next(),pairs(),pcall(),print(),rawequal(),rawget(),rawlen(),rawset(),select(),setmetatable(),tonumber(),tostring(),type(),xpcall(),_G,_VERSION
? https://www.lua.org/manual/5.3/manual.html#6.1
for standard module names

Code: Select all

math, coroutine, io, os, debug, string, table, utf8, package
?
for the boolean keywords/operators

Code: Select all

and, or, not, true, false, nil
?
for the operators

Code: Select all

arithmetic:
+
-
*
/
//
%
^
-
bitwise:
&
|
~
>>
<<
~
relational:
==
~=
<
>
<=
>=
varargs, concatenation, length:
...
..
#
? https://www.lua.org/manual/5.3/manual.html#3.4
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

Good suggestions, will work on it.
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

Updated lexer, pls test, in GH
https://github.com/Alexey-T/CudaText/tr ... ata/lexlib

keywords (not and or....) were already OK.
symbol-operators were OK too, hilited as symbols, do you want separate style for them? why?
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

>The goto statement and the label definition (::labelname::) are missing
Fixed now, updated lex in Github.
> The "table.member" and "table:member" references before and after the function keyword is not recognized.
It will be bad if I won't hilite them as one token + code-tree won't show these items (code-tree needs one token for func name, token with .: ).
Post Reply