Help with User Defined Language: how to configure folding at [random name], other syntax with no end code

2014-03-25
2014-03-27
  • dion starfire

    dion starfire - 2014-03-25

    This feels like a really stupid question, probably because I'm not understanding something right in the guides or the UDL2 page (http://udl20.weebly.com/).

    I can't figure out how to create folding points that don't have an end identifier. Sort of like how the default language handles [some text] (whatever that text may be).

    Actually, I'd like to include that exact pattern as part of my new language, and add another that treats any line that starts with $ as a folding point that contains all the text until the next $. So, for example, for the sample:
    $codename 1
    codes for
    codename 1
    $codename 2
    some codes

    it'd create a folding point at "$codename 1" and "$codename 2".

    I apologize if this issue was addressed elsewhere, but neither google, nor a discussion search turned up an answer within the first 30 results (each) I looked at.

     
  • Loreia2

    Loreia2 - 2014-03-25

    Hi Dion,

    this request popups every now and then, but it is relatively rare, so no wonder you had problems finding relevant threads on forum.

    This is not supported in UDL2. The best thing you can do is to define $ as middle folding point in Folding in code1 type. This will look ugly, but it should work.

    I'd like to include this feature in UDL3, but I still haven't touched folding functionality so we'll see how coding goes once I start with that. It may be part of 3.0 release, or it may be postponed to 3.1 cycle. We'll see.

    Regards,
    Loreia

     
  • dion starfire

    dion starfire - 2014-03-26

    Thanks for your help. I'd been wondering why I couldn't find any examples without a closing identifier. Especially since the built-in lexer clearly handles it. I guess this is another of those functions only available to the internal lexer.

    You might want to add a note to the manual, the wiki, or weebly's page that currently, folding points and multi-line comments require a closing identifier. I imagine a lot of users have come to expect (from other free and open source apps) customizable commands (or, in this case, language definitions) to support any feature available to the internal engine.

    Anyway, thanks for all your hard work in making and supporting this wonderful app.

     
  • Loreia2

    Loreia2 - 2014-03-27

    Hi Dion,

    I imagine a lot of users have come to expect (from other free and open source apps) customizable commands (or, in this case, language definitions) to support any feature available to the internal engine.

    That is not realistic. UDL is a generic code parser/highlighter, it can never match full functionality of all dedicated Scintilla laxers. Some things will simply be too peculiar for a generic lexer. For such tasks dedicated lexers are the way to go.

    BR,
    Loreia