Author Topic: Lua && CMake long-brackets  (Read 687 times)

jporkkahtc

  • Senior Community Member
  • Posts: 1424
  • Hero Points: 111
  • Text
Lua && CMake long-brackets
« on: April 12, 2017, 07:39:51 pm »
Slick doesn't handle long comments in Lua and CMake correctly.
For LUA, Slick does
Start:--[=[
End:]=]

But really, the number of "=" characters matters.
If you use "--[=[" as the start of a comment, then you use "]===]" to end the comment.

See Long Brackets: https://www.lua.org/manual/5.3/manual.html#3.1


Hm... Slick seems to handle LUA long strings correctly, using the same long-bracket syntax.

This is a single string:
Code: [Select]
a = [===[
Sample
String123"]==]
String123"]=]
moreString
]===]

This is a single comment, but Slick doesn't like it:
Code: [Select]
--[==[
Comment
]=]
]===]
]==]

Lee

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1093
  • Hero Points: 94
Re: Lua && CMake long-brackets
« Reply #1 on: April 12, 2017, 08:22:57 pm »
That's a current limitation in v21.  The builtin lexer for Lua only ships with --[[, --[=[ for comment tokens.  Strings are a bit more flexible internally in the color-coding engine, but has limits as well.

The color-coding engine would need to be updated to support full-on regular expressions to handle cases like that.  There is a long standing feature request for allowing more flexibility in the color coding configuration with regular expressions.  I'll be sure to add CMake to the list of languages that need that feature.


jporkkahtc

  • Senior Community Member
  • Posts: 1424
  • Hero Points: 111
  • Text
Re: Lua && CMake long-brackets
« Reply #2 on: April 12, 2017, 08:41:55 pm »
I found I can define multiple Multiline comments.
So, I can define
#[=[            ]=]
#[==[            ]==]
#[===[            ]===]
etc.

Good enough for today at least :-)
In theory, any number of "=" could be used, but in practice I'd imagine some fixed limit (80?) would be good.


BTW, Support for tagging the Cmake language would be nice too.

How does Slick handle "here" docs in languages like shell script and perl?

Lee

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1093
  • Hero Points: 94
Re: Lua && CMake long-brackets
« Reply #3 on: April 12, 2017, 08:55:07 pm »
I'll add a feature request for CMake tagging.

Like all the embedded languages support in SlickEdit, here docs are special cased in the color-coding engine.  When the color-coding bits gets overhauled, adding more flexibility for embedded languages is also part of that same long standing feature request.

jporkkahtc

  • Senior Community Member
  • Posts: 1424
  • Hero Points: 111
  • Text
Re: Lua && CMake long-brackets
« Reply #4 on: April 12, 2017, 09:42:54 pm »
Even better: Make defining new languages with tagging support easier :-)
Then I'll do it myself.

The current state of defining a custom language is pretty messy, and certainly not well documented.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4016
  • Hero Points: 265
Re: Lua && CMake long-brackets
« Reply #5 on: April 13, 2017, 05:50:02 pm »
V22 will have a new color coding engine. Lua multiline comments will work correctly in v22. I'm sure it uses a regex with tagged expressions in the end string.

V22 will have color coding improvements for many languages including C++, HTML, PHP, JavaScript, Perl, Ruby, shell scripts, CSS, Lua, Scala, VB, C#. I'm sure there are improvements in many other languages too. This engine is much more powerful and the color coding definitions have been updated to match the latest version for every language supported by SlickEdit.

jporkkahtc

  • Senior Community Member
  • Posts: 1424
  • Hero Points: 111
  • Text
Re: Lua && CMake long-brackets
« Reply #6 on: April 13, 2017, 05:59:26 pm »
Cool!