Continuation in UDL delimiters



  • Suppose you have a UDL for a language resembling C++, which allows continuation in comments, strings, and specific preprocessor statements. The comment part is easily implemented, as there is a separate “continue” field. String/preprocessors aren’t, however.

    This is what I’m trying accomplish (shown: built-in C highlighter)
    42bd3b73-d83b-4584-b7de-6f6472d1c2f4-image.png

    This is what I get so far (magenta is the default style)
    9c0ed658-4c15-4892-83b8-8429de5634d1-image.png

    For strings, I can kind of make it work by omitting the EOL in Close (with obvious side effects being that unclosed strings eat the rest of the file) or swapping them with comments (since you are less likely to want a continued comment), but not for preprocessors - at most I can make #define a separate keyword, but then # can’t be an operator (since it’ll take precedence over #define) and I have to add a bunch of operators covering various valid adjacency options for #.

    (NPP v.7.8 / UDL v.2.1.0.12)



  • To those whom it might concern, it turned out that using comment as a string means that escape characters don’t work, so I gave up on this and went for delimiter-without-EOL-close + keyword combination.



  • @YellowAfterlife

    one other step you can do to overcome the UDL limitation is to
    use an scripting language plugin like pythonscript and a script
    like discussed here.



  • @Ekopalypse said in Continuation in UDL delimiters:

    @YellowAfterlife

    one other step you can do to overcome the UDL limitation is to
    use an scripting language plugin like pythonscript and a script
    like discussed here.

    That’s pretty cool! I didn’t realize that plugins were allowed to touch Scintilla. Maybe I’d be able to write a native plugin directly if documentation proves sufficient and I find time to do so.


Log in to reply