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

#55 remove unnecessary changes#55 fix parsing of cases when the prepr… #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.number
Original file line number Diff line number Diff line change
@@ -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
Binary file modified proparse.assemblies.zip
Binary file not shown.
Binary file modified proparse.jar
Binary file not shown.
Binary file modified proparse.java.zip
Binary file not shown.
Binary file modified proparse.net.dll
Binary file not shown.
23 changes: 23 additions & 0 deletions src/com/joanju/proparse/Postlexer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down
36 changes: 36 additions & 0 deletions src/test/github55/TestClass.java
Original file line number Diff line number Diff line change
@@ -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();

} }
44 changes: 44 additions & 0 deletions src/test/github55/testCode.p
Original file line number Diff line number Diff line change
@@ -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