Advanced syntax highlight (highlight inside quoted strings)?

2013-10-22
2013-10-30
  • Aleš Berka
    Aleš Berka
    2013-10-22

    Hi Everybody,
    I'm wondering, is it possible to tweak the custom syntax highlighter to highlight different language inside quotes?

    Example:

    START-OF-SELECTION.
       CONCATENATE
         'for (myId: ids) {'
           'output = concat(myId, ", ");
         '}'
       INTO lv_output.

    I do not want to loose the highlighting of strings (let's say one colour), I just want additional formatting to that. Highlight keywords, numbers, possibly another strings (doublequotes). I do not insist on strict isolation of keywords inside / outside - ie. if "for" get's recognized as keyword even outside of the quotes, I still take it.

    Any chance to get something like this? At least partially?

    Thanks a lot!
    Aleš

     
  • Aleš Berka
    Aleš Berka
    2013-10-22

    Background: The outer language is ABAP (I do have custom highligher for it already), which generates custom language, which is interpreted later in the workflow (on the mobile device).

     
  • Loreia2
    Loreia2
    2013-10-22

    Hi Aleš,

    yes, you can do this. Just define, say, Delimiter1 as string, and in Styler of Delimiter1 define which keywords type get nested in Delimiter1. That would be all.

    If you have any problem with this, just ask again.

    BR,
    Loreia

     
  • Aleš Berka
    Aleš Berka
    2013-10-27

    Hi Loreia,
    that's really cool, I was able to customize it a lot, thank you!

    For some reason I can't get number coloring to work but I'll keep trying. It's not that critical anyway, the keywords do help a lot.

    Aleš

     
  • Aleš Berka
    Aleš Berka
    2013-10-28

    Is it possible to use one delimiter only inside another (nested) - let's say to use Delimiter 8 only inside Delimiter 1, but not globally?

    ....or....
    to support keywords even if they are immediately followed by "(" (not whitespace inbetween)?

    Thanks again!

     
  • Loreia2
    Loreia2
    2013-10-28

    Hi Aleš,

    just define ( and ) as Operator1 type.
    The other thing is not possible in UDL 2. It will be included in the UDL3.0

    Can you give me an example when you can't highlight numbers? I am not aware of any problems with number recognition.

    BR,
    Loreia

     
  • Aleš Berka
    Aleš Berka
    2013-10-30

    Hi Loreia,
    thanks for your answer, I really appreciate that.

    Defining ( and ) as Operator 1 isn't helping, I do have it there already. What helped me was to introduce ( and ) as Delimiter 8 - and nest the other keywords and stuff under that Delimiter.

    The issue with numbers must have been my mistake, I have reviewed the whole settings, tweaked it a bit and now it's ok. Sorry for false alarm.

    Regarding UDL3 - any chance enter any kind of private alpha/beta test? I have hit the limits of UDL2 I think as I'm coding language in a language. For instance the quotes do define single line comment in the outer language (ABAP), yet they define strings in the inner language. Plus as mentioned, some keywords should be valid only nested, not in general scope. I understand this is pretty complex scenario.

    Example:

       " This is a comment, let's create some inner language concat now
       CONCATENATE
           'x = 10;'           " This is another comment, here we set x to 10
           'y = "Hello";'   " This is another another comment, on this line we set y to Hello

    ...

    I will gladly send you my current language spec and complex sample input file, if you are interested, as there are more caveats in this damned setup. I wasn't able to find your e-mail address so if you mail me at this disposable e-mail: notepadplusplus.7y5 AT gishpuppy POINT com I'll reply right away with attachments.

    Thanks, Best regards,
    Aleš

     
  • Loreia2
    Loreia2
    2013-10-30

    Hi Aleš,

    UDL 3.0 isn't going to be ready soon. I hoped to have to in beta phase by the end of this year, but it looks like I'll have to postpone it for 2014.

    As soon as I have something stable, I will open a UDL3.0 thread for early testers. Up to then you are out of luck.

    My e-mail is udlv20 _ at _ gmail _ dot _ com

    BR
    Loreia