Page 1 of 1

Lua lexer

Posted: 16.02.2020 14:49
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

Posted: 16.02.2020 15:01
by Alexey
Good suggestions, will work on it.

Posted: 16.02.2020 17:24
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?

Posted: 18.02.2020 12:07
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 .: ).