Closed g-back closed 3 years ago
Nice one, it should not be that hard with regex, but maybe instead one, there will be a need to use more of the regexes.
Will take a look on it.
something for testing,
types eq type c.
data eq type eq.
if strlen( eq ) eq eq and eq eq eq and boolc( eq eq eq ) eq eq.
endif.
That would be impossible to solve :smile:
if compiler can handle this, then it is possible 😄 but maybe not with regex 😄
The list of keywords and functions that operators can appear in:
What else I miss? This could be starting point to check if in current statement one the keywords appear.
There is a where-used list in the bottom of https://syntax.abaplint.org/?filter=compare#/expression/CompareOperator, which might help.
Its ABAP so there is always another special case, and note syntax.abaplint.org is also not complete but runs okay for a lot of code
Thanks Lars, I will go through it. The other option would be to get the info directly from ADT editor, so far I haven't found the styled editor control, only plain text, but I will also deep dive into it.
tried to make an overview, https://syntax.abaplint.org/expression_CompareOperator_WhereUsed.svg, did not work out very well :)
Is that where-used list for "eq" only?? That's huge!
yea, it is, basically EQ can be used inside boolc
, and boolc can be used almost anywhere
I found the solution for this, but firstly I will finish the book and then I will implement this :) I followed the idea of getting if the token is keyword or not from ADT classes.
I've created a new branch with the solution for this. So far using the old interfaces, but better that this would be splitted into separate solution, as it uses other technique. Example of @larshp works perfectly.
Branch 1.0.13_EQ
is there a chance that someone will help me to redesign architecture of the StatementAssistProcessor to fit two scenarios, old using regex and new using internal ADT classes? I don't want to refactor everything as I don't have commitment from SAP about the internal classes that they will became API someday yet.
Relasesd with 1.0.13
Idea for new quick fix: replace operators "EQ" "NE" with their "proper" counterparts. I'd try this myself but there's a couple of traps:
My regex abilities are unfortunately not good enough to handle those traps...