• Login
Community
  • Login

Limitations on UDL?

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
5 Posts 3 Posters 1.9k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F
    Felix Wagner
    last edited by Felix Wagner Mar 12, 2018, 12:48 PM Mar 12, 2018, 12:47 PM

    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?

    C 1 Reply Last reply Mar 13, 2018, 2:19 PM Reply Quote 0
    • C
      Claudia Frank @Felix Wagner
      last edited by Mar 13, 2018, 2:19 PM

      @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

      Cheers
      Claudia

      1 Reply Last reply Reply Quote 1
      • F
        Felix Wagner
        last edited by Mar 13, 2018, 10:30 PM

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

        1 Reply Last reply Reply Quote 0
        • C
          CatMeat
          last edited by CatMeat Mar 19, 2018, 11:14 PM Mar 19, 2018, 11:13 PM

          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.

          C 1 Reply Last reply Mar 20, 2018, 12:27 PM Reply Quote 0
          • C
            Claudia Frank @CatMeat
            last edited by Claudia Frank Mar 20, 2018, 12:27 PM Mar 20, 2018, 12:27 PM

            @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?

            Cheers
            Claudia

            1 Reply Last reply Reply Quote 1
            2 out of 5
            • First post
              2/5
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors