consultingwerk / proparse

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

Issue with FOREIGN-KEY-HIDDEN #48

Closed DanielBaciu closed 3 years ago

DanielBaciu commented 3 years ago

We have some dataset relations defined with FOREIGN-KEY-HIDDEN. This is not supported by proparse.

define dataset ds for tt1, tt2 data-relation for tt1, tt2 relation-fields(f_key, f_key) foreign-key-hidden nested.

foreign-key-hiddenExample.p:8:60: unexpected token: foreign-key-hidden

Thank you for checking.

mikefechner commented 3 years ago

Please indicate which Proparse release you are using and please provide a complete sample of a ProDataset definition (including temp-table definitions) that fails.

Are you intending to fix this yourself and issue a pull-request?

DanielBaciu commented 3 years ago

I'm using proparse.dll version 4.1.0.1219. Please fix it if possible.

The complete error stack is:

Original Exception: unexpected token: foreign-key-hidden

foreign-key-hiddenExample.p:8:60: unexpected token: foreign-key-hidden
at com.joanju.proparse.ProParser.definedatasetstate(ProParser.java:35669)
at com.joanju.proparse.ProParser.definestatement(ProParser.java:7605)
at com.joanju.proparse.ProParser.statement(ProParser.java:2656)
at com.joanju.proparse.ProParser.blockorstate(ProParser.java:560)
at com.joanju.proparse.ProParser.program(ProParser.java:120)
at com.joanju.proparse.DoParse.doParse(DoParse.java:202)
at org.prorefactor.treeparser.ParseUnit.parse(ParseUnit.java:270)
at org.prorefactor.treeparser.ParseUnit.parse(ParseUnit.java:226)
at org.prorefactor.treeparser.ParseUnit.treeParser01(ParseUnit.java:348)
at cli.Progress.ClrBridge.ClrApi.InvokeMethod(Unknown Source)

foreign-key-hidden.zip

mikefechner commented 3 years ago

The issue seems be with the order of the NESTED and the FOREIGN-KEY-HIDDEN keywords. The ABL syntax reference specifies the DATA-RELATION phrase like

parent-buffer-name, child-buffer-name field-mapping-phrase
[ REPOSITION ][ NESTED [ FOREIGN-KEY-HIDDEN ]][ NOT-ACTIVE ] 
[ RECURSIVE ]

With NESTED being a parent of FOREIGN-KEY-HIDDEN. In your ABL syntax sample FOREIGN-KEY-HIDDEN is used as a sibling of NESTED and in reverse order).

Suggestion is that you fix your ABL source code to comply with the documented syntax. If we'd be changing the grammar to have NESTED and FOREIGN-KEY-HIDDEN as siblings in random order, I'm afraid that the result would be a different AST. And for us, ProDatasets are particularly important during parsing ...

DanielBaciu commented 3 years ago

Indeed, the syntax is as you described. I updated the code and it is parsing well. This ticket can be close.

Thank you for checking. Daniel.