Limitations on UDL?

  • Hi there!

    I’ve created my own UDF to be used with a C-style scripting language. Unfortunately, I ran into a few limitations with this function or I just miss the obvious steps to take here. That’s why I’m asking.

    E.g. numbers. Numbers are only recognised (and styled) as such if surrounded by spaces. So " 5 " is okay. But this does not really cover the reality of programming, I guess? At least not my style. Functions calls like “foo(5)” are not out of the ordinary. I’ve never seen someone using spaces there. I fixed that by making ( ) Delimiters (without any styling) and allow nesting of numbers. But then it fails at this: “foo(5, 5)”. The second one is styled, the first one not (because of the comma).
    It’s the same with keywords. true and false are keywords and are recognised if surrounded by spaces or ( ) (because of nesting). But a simple “var bar = false;” fails because of ; after the false.

    Is there something I’m not seeing here or are these things just limitations of UDLs?

  • @Felix-Wagner

    Yes, UDL has some limitations but those two can be solved if you still have a delimiter
    style option and are willing to add the comma to the operators list.

    I would define ; as the open delimiter and ((EOL)), then it should look like


  • Thanks a lot. That was exactly the kind of trickery I needed!

  • I have some numbers not being styled as well. I already have the comma in the operators list as well as the semi-colon as the open delimiter and ((EOL)) as the close

    The 2728 in this example is styled properly: [Info(“List”, “JohnRay”, “2.0.0”, Resource = 2728)]

    yet… these are not:
    float compareRadius = 50;
    float apcRadius = 100.0f;

    I don’t know what is needed to help figure it out. Let me know and I will post.

  • @CatMeat

    The issue with lexing/parsing is always when having “glued” characters, means
    how can a lexer/parser know that 100.0f is really the number and not 100.0f; ?

    As UDL can only parse the given string and can’t really do any lexical analysis,
    as it don’t know the language, we need to tweak,hack around such complications.

    In the given case, I would use = as an open and semicolon as closing char in a delimiter
    which is setup with the same color as the default color and allowing nesting with numbers.
    But this could be that it breaks other things, may I ask which language you are trying to build?


Log in to reply