[BUG] LUA-Style multiline comments in UDL

2. Help
2012-12-12
2012-12-12
  • Hello, I am trying to define a custom language based mostly on LUA, and, as some of you might know, this language defines multiline comments to begin with the "--[[" sequence of characters, and to end with "]]". The problem is, though, that single-line comments begin with "--", and this makes the language interpreter think the multiline comment is just a comment line, and it doesn't process it further. Is there a way to fix this behaviour?

     
  • Loreia2
    Loreia2
    2012-12-12

    Hi Riccardo,

    Try to use delimiters to define your comment sequences.

    Multi-line comments as Delimiter1:
    Open: --[[

    Close: ]]

    Line comments as Delimiter2:
    Open: --
    Close:((EOL))

    You can use any Delimiter (not just 1 and 2), but make sure Multi-line comments are defined first (because that will trigger multi-lines comments before single line comments)

    BR,
    Loreia

     
  • Hello Loreia,
    thank you for your support. Setting it up as you said did the trick, but this really looks like just a workaround and not the way to handle it properly. Also, there seems to be a strange issue in defining single-line comment delimiters: when writing a comment, it considers EVERYTHING above it as part of the comment (folding-wise, but the colors are okay), so a + appears on the left and if I press on it, it just collapses everything from that point until the EOF... it is pretty annoying. It's not much of an issue, I know, but it still looks like a bug to me.
    Best regards,

    Riccardo

     
  • Loreia2
    Loreia2
    2012-12-12

    Hi Riccardo,

    that definitively sounds like a bug.
    Can you share a screen capture of that error?
    And a small code sample that would be enough to reproduce the issue.
    Add also your userDefineLang.xml file.

    .

    Setting it up as you said did the trick, but this really looks like just a workaround and not the way to handle it properly.

    .
    This is a feature of delimiter type, not a hack or workaround. Next version of UDL will have comments removed completely, delimiters will be used instead.

    BR,
    Loreia