consultingwerk / proparse

Proparse, forked from http://www.oehive.org/proparse/
Other
18 stars 9 forks source link

Issue with keyword "OLD" in assign trigger #23

Open siegetsleitnerj opened 6 years ago

siegetsleitnerj commented 6 years ago

Code to reproduce:

ON ASSIGN OF Kunde.Gewicht OLD VALUE lOld DO: END.

Proparse error: org.prorefactor.refactor.RefactorException: Error parsing test_old.p unexpected token: OLD

akera-io commented 6 years ago

By looking at the code this should work, in fact, it does work in unit tests... the only explanation would be the field is missing from the database schema. If the field is not found then the reference is null and indeed the parse fails with this 'potentially' misleading error :(

mikefechner commented 6 years ago

lOld is probably a local variable.

akera-io commented 6 years ago

That's an ID so it can be anything, I'm talking about the field name here - Kunde.Gewicht.

siegetsleitnerj commented 6 years ago

Kunde.Gewicht is valid field from connected database. I tested too with customer.custnum from Sports2000 database and this gives the same result: org.prorefactor.refactor.RefactorException: Error parsing test_old.p unexpected token: OLD

akera-io commented 6 years ago

I didn't say it's not a valid field in your database, just that proparse doesn't know about this... Mike might know more about how database schema(s) are added to proparse in .Net or how to generate those .schema files out of a given database. If you are using such a .schema file can you please upload that so I can check it out?

siegetsleitnerj commented 6 years ago

Regrettably I do not have too much knowledge, how things work in the background. (I use prolint and proparse is used in background).

So I tested the following code connected to sports2000 database. When I comment out / OLD VALUE lOLD / then everything is OK. No errors are reported. When I activate again I get proparse error like reported. So I do not think it is the xchema of the database.

on assign of customer.custnum / OLD VALUE lOld / do: Message "Debug" view-as alert-box. end.

do transaction: find first customer exclusive-lock. customer.custnum = customer.custnum + 100000. end.

gquerret commented 6 years ago

Syntactic predicate in 'onstate' can't work as it contains an 'or' clause in third position, while lookahead is set at 2 for the grammar. Splitting the syntactic predicate is the only viable solution IMHO. See https://github.com/Riverside-Software/sonar-openedge/commit/be2d08982089cdac52eee25f182d9f0efcbfe072#diff-c78de5f177d1d9db57e6c271884c214d

akera-io commented 6 years ago

indeed, was confused by the fact that fully specifying the field db.table.field worked fine if the field was found in the schema... you guys should really consider working on a single code base :)