UDL definition for keywords that begin with an operator

  • I’m trying to update a version of the UDL for Ansys APDL to recognize all the operators; specifically including the divide ( / ) and multiply ( * ) symbols, as well as all of the keywords. The problem is that there’s a whole group of keywords used in APDL that begin with both “/” and “*”; so if I include the divide and multiple operators, it doesn’t highlight those keywords. Is there a way to have the operators only recognized if they appear somewhere after the beginning of the line? Something like {wildcard symbol}{the operator}?
    Or, maybe a way to enforce an order of searching. For example: first look for comments, then look for folding, then keywords, and finally operators.

    Anyway, any help or suggestions would be appreciated.

    Thank you.

  • There is no “wildcard symbol” in the UDL definitions. And there’s no way to enforce order of matching.

    I think if you included the / and * in the “Operators 2 (separators required)” rather than in “Operators 1”, it might do what you want – in that it won’t treat them as operators unless they are separated by a space from surrounding text. Unfortunately, it also means that it would recognize 4 / 2 but not 4/2. As far as I know, you cannot have it both ways.

  • In this thread, @Claudia-Frank gives an example of a “custom lexer” that’s written in PythonScript, rather than requiring compiling a new DLL for the custom lexer. You might be able to take those concepts and write up a solution that’s specific to your needs. (I’ve never experimented with that… some day, I really need to, so that I can better help people use it.)

  • Thanks for the feedback.

    Anyway, it looks like the option of putting spaces around those operators would do what I was looking for. Unfortunately, I think I’d rather leave these operators as unidentified, rather than implementing the extra spaces in the code. The improvement in ability to visually scan through the code isn’t improved that much, I don’t think, to make the extra effort worth it.

    But again, thank you for the responses.

  • Hello Forum,
    I have a very similar problem. I trie to write a xml file to autocomplete ansys apdl syntax. In the case of keyworts without slash and star everything works fine. The Keywords with extra sign * or / are shown in the dropdown box but I can’t autocomplete it.

    Can someone tell me what’s going wrong?

    Thanks Tobias