Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad DEFINED function in &IF preprocessor condition #55

Open
DanielBaciu opened this issue Sep 22, 2021 · 1 comment
Open

Bad DEFINED function in &IF preprocessor condition #55

DanielBaciu opened this issue Sep 22, 2021 · 1 comment

Comments

@DanielBaciu
Copy link

Hi,

We have the following structure in many include files, to make sure that definition of temp-table is included only once.

&if defined(i_tt{&prefix}companydata{&suffix}) = 0 &then
&global-define i_tt{&prefix}companydata{&suffix} yes
define temp-table tt{&prefix}CompanyData{&suffix} ...
&endif

When parsing the .p file we get this error:

Bad DEFINED function in &IF preprocessor condition

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

The complete error stack is:

    java.lang.RuntimeException: java.lang.IllegalArgumentException: C:\Projects\reverse-engineering-oe\src\ttCompanyData.i:14 Bad DEFINED function in &IF preprocessor condition
    	at com.joanju.proparse.Postlexer.nextToken(Postlexer.java:81)
    	at com.joanju.proparse.Postlexer.<bridge>nextToken(Postlexer.java:1)
    	at com.joanju.proparse.TokenList.build(TokenList.java:37)
    	at com.joanju.proparse.DoParse.doParse(DoParse.java:146)
    	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)
    Caused by: java.lang.IllegalArgumentException: C:\Projects\reverse-engineering-oe\src\ttCompanyData.i:14 Bad DEFINED function in &IF preprocessor condition
    	at com.joanju.proparse.Postlexer.throwMessage(Postlexer.java:322)
    	at com.joanju.proparse.Postlexer.defined(Postlexer.java:98)
    	at com.joanju.proparse.Postlexer.preproIfCond(Postlexer.java:278)
    	at com.joanju.proparse.Postlexer.preproIf(Postlexer.java:172)
    	at com.joanju.proparse.Postlexer.nextToken(Postlexer.java:53)
    	at com.joanju.proparse.Postlexer.<bridge>nextToken(Postlexer.java:1)
    	at com.joanju.proparse.TokenList.build(TokenList.java:37)
    	at com.joanju.proparse.DoParse.doParse(DoParse.java:147)
    	at org.prorefactor.treeparser.ParseUnit.parse(ParseUnit.java:271)
    	... 3 more

An example can be found in attachment below.
Bad_DEFINED_function.zip

Thank you!

@DanielBaciu
Copy link
Author

HI,

I add another example where a simple ADM2 SmartdataObject generates the same error.

java.lang.RuntimeException: java.lang.IllegalArgumentException: c:\ws\dev\11.7relatief\src/adm2/query.i:184 Bad DEFINED function in &IF preprocessor condition
at com.joanju.proparse.Postlexer.nextToken(Postlexer.java:81)
at com.joanju.proparse.Postlexer.nextToken(Postlexer.java:1)
at com.joanju.proparse.TokenList.build(TokenList.java:37)
at com.joanju.proparse.DoParse.doParse(DoParse.java:146)
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)
Caused by: java.lang.IllegalArgumentException: c:\ws\dev\11.7relatief\src/adm2/query.i:184 Bad DEFINED function in &IF preprocessor condition
at com.joanju.proparse.Postlexer.throwMessage(Postlexer.java:322)
at com.joanju.proparse.Postlexer.defined(Postlexer.java:98)
at com.joanju.proparse.Postlexer.preproIfCond(Postlexer.java:278)
at com.joanju.proparse.Postlexer.preproIf(Postlexer.java:172)
at com.joanju.proparse.Postlexer.nextToken(Postlexer.java:53)
at com.joanju.proparse.Postlexer.nextToken(Postlexer.java:1)
at com.joanju.proparse.TokenList.build(TokenList.java:37)
at com.joanju.proparse.DoParse.doParse(DoParse.java:147)
at org.prorefactor.treeparser.ParseUnit.parse(ParseUnit.java:271)
... 3 more

ADM2 SmartDataObject.zip

DanielBaciu pushed a commit to DanielBaciu/proparse that referenced this issue Oct 5, 2021
… is used inside the name checked by DEFINED() function.

e.g.
&if defined(i_tt{&prefix}companydata{&suffix}) = 0 &then
&IF DEFINED(OPEN-QUERY-{&QUERY-NAME}) NE 0 &THEN
DanielBaciu pushed a commit to DanielBaciu/proparse that referenced this issue Oct 5, 2021
…when the preprocessor variable is used inside the name checked by DEFINED() function.

e.g.
&if defined(i_tt{&prefix}companydata{&suffix}) = 0 &then
&IF DEFINED(OPEN-QUERY-{&QUERY-NAME}) NE 0 &THEN#55 fix parsing of cases when the preprocessor variable is used inside the name checked by DEFINED() function.
e.g.
&if defined(i_tt{&prefix}companydata{&suffix}) = 0 &then
&IF DEFINED(OPEN-QUERY-{&QUERY-NAME}) NE 0 &THEN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant