diff --git a/build.number b/build.number index 2f506cc..1a14f41 100644 --- a/build.number +++ b/build.number @@ -1,3 +1,3 @@ #Build Number for ANT. Do not edit! -#Tue Aug 03 15:26:44 CEST 2021 -build.number=1225 +#Tue Oct 05 12:34:43 EEST 2021 +build.number=1226 diff --git a/proparse.assemblies.zip b/proparse.assemblies.zip index f4a6471..9aee31e 100644 Binary files a/proparse.assemblies.zip and b/proparse.assemblies.zip differ diff --git a/proparse.jar b/proparse.jar index 287beae..a88abe9 100644 Binary files a/proparse.jar and b/proparse.jar differ diff --git a/proparse.java.zip b/proparse.java.zip index c8d336b..2be695f 100644 Binary files a/proparse.java.zip and b/proparse.java.zip differ diff --git a/proparse.net.dll b/proparse.net.dll index 87e7ef2..30b8ead 100644 Binary files a/proparse.net.dll and b/proparse.net.dll differ diff --git a/src/com/joanju/proparse/Postlexer.java b/src/com/joanju/proparse/Postlexer.java index 48f913a..0486244 100644 --- a/src/com/joanju/proparse/Postlexer.java +++ b/src/com/joanju/proparse/Postlexer.java @@ -87,13 +87,36 @@ ProToken defined() throws IOException { // Progress DEFINED() returns a single digit: 0,1,2, or 3. // The text between the parens can be pretty arbitrary, and can // have embedded comments, so this calls a specific lexer function for it. + // We may have macro usage inside the preprocessor string, which we need to skip + // lexer.getAmpIfDefArg returns expansed name getNextToken(); if (currToken.getType() == WS) getNextToken(); if (currToken.getType() != LEFTPAREN) throwMessage("Bad DEFINED function in &IF preprocessor condition"); + + // in case the token starts with a preprocessor we skip it. need to get to preprocessed value, + for (;currToken.getType() == MAKROREFERENCE;) + getNextToken(); + ProToken argToken = lexer.getAmpIfDefArg(); + + // when preprocessor variable to check starts with a preprocessor include, + // we take next one + for (;argToken.getType() == MAKROREFERENCE;) + argToken = lexer.getAmpIfDefArg(); + + // skip other preprocessors + for (;currToken.getType() == MAKROREFERENCE;) + getNextToken(); + getNextToken(); + + // consume last preprocessors + for (;currToken.getType() == MAKROREFERENCE;){ + getNextToken(); + } + if (currToken.getType() != RIGHTPAREN) throwMessage("Bad DEFINED function in &IF preprocessor condition"); return new ProToken(filenameList, NUMBER, prepro.defined(argToken.getText().trim().toLowerCase())); diff --git a/src/test/github55/TestClass.java b/src/test/github55/TestClass.java new file mode 100644 index 0000000..c8324b9 --- /dev/null +++ b/src/test/github55/TestClass.java @@ -0,0 +1,36 @@ +package test.github55; + +import java.io.File; + +import org.prorefactor.core.JPNode; +import org.prorefactor.treeparser.ParseUnit; + +import com.joanju.proparse.NodeTypes; + +import junit.framework.Assert; +import junit.framework.TestCase; + +public class TestClass extends TestCase { + + public void test() throws Exception { + + com.joanju.proparse.Environment proparseEnv = null; + org.prorefactor.core.schema.Schema proparseSchema = null; + + proparseEnv = com.joanju.proparse.Environment.instance(); + proparseSchema = org.prorefactor.core.schema.Schema.getInstance(); + + proparseSchema.clear(); + + proparseEnv.configSet ("batch-mode", "false"); + proparseEnv.configSet ("opsys", "WIN32"); + proparseEnv.configSet ("proversion", "12.2"); + proparseEnv.configSet ("window-system", "MS-WINXP"); + + + File file = new File("C:\\Work\\Proparse\\Github\\proparse\\src\\test\\github55\\testCode.p"); + ParseUnit pu = new ParseUnit(file); + + pu.treeParser01(); + + } } diff --git a/src/test/github55/testCode.p b/src/test/github55/testCode.p new file mode 100644 index 0000000..e4cfc31 --- /dev/null +++ b/src/test/github55/testCode.p @@ -0,0 +1,44 @@ +/*------------------------------------------------------------------------ + File : testCode.p + Purpose : + + Syntax : + + Description : + + Author(s) : Daniel + Created : Mon Oct 04 11:57:10 CET 2021 + Notes : + ----------------------------------------------------------------------*/ + +/* *************************** Definitions ************************** */ + +block-level on error undo, throw. + +/* ******************** Preprocessor Definitions ******************** */ + +/* preprocessor in middle and at the end of checked preprocessor variable*/ +&if defined(i_tt{&prefix}companydata{&suffix}) = 0 &then +&global-define i_tt{&prefix}companydata{&suffix} yes +define {&scope} temp-table tt{&prefix}CompanyData{&suffix} no-undo {&reference-only} before-table bt{&prefix}CompanyData{&suffix} + field Company as character /* bedrijf */. +&ENDIF + + +/* preprocessor at begining of checked preprocessor variable */ +&IF DEFINED({&PREFIX}TTEqSearchModel-I) = 0 &THEN +&GLOBAL-DEFINE {&PREFIX}TTEqSearchModel-I 1 + +def {&SCOPE} temp-table {&PREFIX}ttEqSearchModel no-undo {&REFERENCE-ONLY} + field SortOrder as int. + +&ENDIF + +/* *************************** Main Block *************************** */ +&SCOP QUERY-NAME Query-Main +&Scoped-define OPEN-QUERY-Query-Main OPEN QUERY Query-Main FOR EACH baktype NO-LOCK INDEXED-REPOSITION. + +&IF DEFINED(OPEN-QUERY-{&QUERY-NAME}) NE 0 &THEN + define variable hQuery as handle no-undo. + define variable hBuffer as handle no-undo. +&ENDIF \ No newline at end of file