Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release/V2.21.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
gquerret committed Apr 27, 2023
2 parents d175c8d + 323f7b5 commit 98e8b7e
Show file tree
Hide file tree
Showing 35 changed files with 935 additions and 101 deletions.
16 changes: 8 additions & 8 deletions coverage-report/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>coverage-report</artifactId>
<version>2.20.0</version>
<version>2.21.0</version>

<name>JaCoCo report</name>
<description>Fake module for code coverage report in SonarQube</description>
Expand All @@ -20,37 +20,37 @@
<dependency>
<groupId>eu.rssw.openedge.rcode</groupId>
<artifactId>rcode-reader</artifactId>
<version>2.20.0</version>
<version>2.21.0</version>
</dependency>
<dependency>
<groupId>eu.rssw.sonar.openedge</groupId>
<artifactId>sonar-openedge-plugin</artifactId>
<version>2.20.0</version>
<version>2.21.0</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>proparse</artifactId>
<version>2.20.0</version>
<version>2.21.0</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>profiler-parser</artifactId>
<version>2.20.0</version>
<version>2.21.0</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>database-parser</artifactId>
<version>2.20.0</version>
<version>2.21.0</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>listing-parser</artifactId>
<version>2.20.0</version>
<version>2.21.0</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.checks</groupId>
<artifactId>openedge-checks</artifactId>
<version>2.20.0</version>
<version>2.21.0</version>
</dependency>
</dependencies>

Expand Down
2 changes: 1 addition & 1 deletion database-parser/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>database-parser</artifactId>
<version>2.20.0</version>
<version>2.21.0</version>

<name>OpenEdge database definition lexer and parser</name>
<description>OpenEdge dump files parser</description>
Expand Down
2 changes: 1 addition & 1 deletion listing-parser/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>listing-parser</artifactId>
<version>2.20.0</version>
<version>2.21.0</version>

<name>OpenEdge listing so-called parser</name>
<description>OpenEdge listing files parser</description>
Expand Down
6 changes: 3 additions & 3 deletions openedge-checks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>eu.rssw.openedge.checks</groupId>
<artifactId>openedge-checks</artifactId>
<version>2.20.0</version>
<version>2.21.0</version>

<name>OpenEdge checks</name>
<description>OpenEdge checks</description>
Expand Down Expand Up @@ -55,12 +55,12 @@
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>database-parser</artifactId>
<version>2.20.0</version>
<version>2.21.0</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>proparse</artifactId>
<version>2.20.0</version>
<version>2.21.0</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
Expand Down
10 changes: 5 additions & 5 deletions openedge-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>eu.rssw.sonar.openedge</groupId>
<artifactId>sonar-openedge-plugin</artifactId>
<version>2.20.0</version>
<version>2.21.0</version>
<packaging>sonar-plugin</packaging>

<name>OpenEdge plugin for SonarQube</name>
Expand Down Expand Up @@ -60,17 +60,17 @@
<dependency>
<groupId>eu.rssw.openedge.checks</groupId>
<artifactId>openedge-checks</artifactId>
<version>2.20.0</version>
<version>2.21.0</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>listing-parser</artifactId>
<version>2.20.0</version>
<version>2.21.0</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>profiler-parser</artifactId>
<version>2.20.0</version>
<version>2.21.0</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
Expand All @@ -85,7 +85,7 @@
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20210307</version>
<version>20230227</version>
</dependency>
<dependency>
<groupId>org.sonarsource.sonarqube</groupId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>eu.rssw</groupId>
<artifactId>sonar-openedge</artifactId>
<version>2.20.0</version>
<version>2.21.0</version>
<packaging>pom</packaging>

<name>OpenEdge plugin for SonarQube</name>
Expand Down
2 changes: 1 addition & 1 deletion profiler-parser/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>profiler-parser</artifactId>
<version>2.20.0</version>
<version>2.21.0</version>

<name>OpenEdge profiler output lexer and parser</name>
<description>OpenEdge profiler files parser</description>
Expand Down
4 changes: 2 additions & 2 deletions proparse/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>proparse</artifactId>
<version>2.20.0</version>
<version>2.21.0</version>

<name>Proparse</name>
<description>ABL code parser</description>
Expand Down Expand Up @@ -55,7 +55,7 @@
<dependency>
<groupId>eu.rssw.openedge.rcode</groupId>
<artifactId>rcode-reader</artifactId>
<version>2.20.0</version>
<version>2.21.0</version>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1738,6 +1738,16 @@ defineParamVarLike:
( caseSensitiveOrNot | formatExpression | decimalsExpr | initialConstant | labelConstant | NOUNDO | extentPhrase )*
;

defineParamVar2:
( AS datatype | LIKE fieldExpr )
( formatExpression | initialConstant | labelConstant | NOUNDO )*
;

defineParamVar3:
( AS datatype | LIKE fieldExpr )?
( formatExpression | initialConstant | labelConstant | NOUNDO )*
;

definePropertyStatement:
DEFINE defineShare? modifiers=definePropertyModifier*
PROPERTY n=newIdentifier definePropertyAs
Expand Down Expand Up @@ -2812,7 +2822,8 @@ onStatement:
)
( REVERT statementEnd
| PERSISTENT RUN filenameOrValue inExpression? onstateRunParams? statementEnd
| { support.addInnerScope(_localctx); } blockOrStatement { support.dropInnerScope(); }
| { support.addInnerScope(_localctx); } DO blockColon blockOrStatement* END statementEnd { support.dropInnerScope(); }
| blockOrStatement
)
)
;
Expand Down Expand Up @@ -3522,7 +3533,7 @@ triggerProcedureStatement:
(
triggerProcedureStatementSub1
| triggerProcedureStatementSub2
| ASSIGN triggerOf? triggerOld?
| ASSIGN ( triggerOf triggerOld? )?
)
statementEnd
;
Expand All @@ -3539,16 +3550,16 @@ triggerProcedureStatementSub2:

triggerOf:
OF fieldExpr triggerTableLabel? # triggerOfSub1
| NEW VALUE? id=identifier defineParamVar # triggerOfSub2
| NEW VALUE? id=identifier defineParamVar2 # triggerOfSub2
;

// Found this in PSC's grammar
triggerTableLabel:
// Found this in PSC's grammar
TABLE LABEL constant
;

triggerOld:
OLD VALUE? id=identifier defineParamVar?
OLD VALUE? id=identifier defineParamVar3
;

underlineStatement:
Expand Down Expand Up @@ -3646,7 +3657,7 @@ waitForStatement:
waitForFocus?
pauseExpression?
( EXCLUSIVEWEBUSER expression? )?
| // This is for a .Net WAIT-FOR, and will be in the tree as #(Widget_ref ...)
| // This is for a .Net WAIT-FOR
expressionTerm waitForSet?
)
statementEnd
Expand Down
109 changes: 93 additions & 16 deletions proparse/src/main/java/org/prorefactor/core/ABLNodeType.java
Original file line number Diff line number Diff line change
Expand Up @@ -2832,6 +2832,18 @@ public boolean isRecordFunc() {
return RECORD_FUNCTIONS.contains(this);
}

/**
* Returns uppercase of the type info record's full text. Returns null if there's no type info for the type number.
* Returns empty string if there's no text for the type.
*/
public String getFullText() {
if (this.options.contains(NodeTypesOption.PLACEHOLDER))
return null;
if (!this.options.contains(NodeTypesOption.KEYWORD))
return "";
return Strings.nullToEmpty(this.text).toUpperCase();
}

public boolean isAbbreviated(String txt) {
if (Strings.isNullOrEmpty(txt) || !isKeyword())
return false;
Expand Down Expand Up @@ -2889,13 +2901,7 @@ static boolean isValidType(int type) {
*/
public static String getFullText(int type) {
ABLNodeType e = typeMap.get(type);
if (e == null)
return null;
if (e.options.contains(NodeTypesOption.PLACEHOLDER))
return null;
if (!e.options.contains(NodeTypesOption.KEYWORD))
return "";
return Strings.nullToEmpty(e.text).toUpperCase();
return e == null ? null : e.getFullText();
}

public static ABLNodeType getLiteral(String text) {
Expand All @@ -2911,15 +2917,6 @@ public static ABLNodeType getLiteral(String text, ABLNodeType defaultType) {
return type;
}

public static String getFullText(String text) {
if (text == null)
return "";
ABLNodeType type = literalsMap.get(text.toLowerCase());
if (type == null)
return "";
return type.text.toUpperCase();
}

/**
* Get the type number for a type name. For those type names that have it, the "_KW" suffix is optional.
*
Expand Down Expand Up @@ -3072,6 +3069,86 @@ public static DataType getDataType(int nodeType) {
}
}

/**
* @see ABLNodeType#getDataType(int)
*/
public static ABLNodeType getNodeType(DataType dataType) {
switch (dataType.getPrimitive()) {
case VOID:
return ABLNodeType.VOID;
case CHARACTER:
return ABLNodeType.CHARACTER;
case DATE:
return ABLNodeType.DATE;
case LOGICAL:
return ABLNodeType.LOGICAL;
case INTEGER:
return ABLNodeType.INTEGER;
case DECIMAL:
return ABLNodeType.DECIMAL;
case RECID:
return ABLNodeType.RECID;
case RAW:
return ABLNodeType.RAW;
case HANDLE:
return ABLNodeType.HANDLE;
case MEMPTR:
return ABLNodeType.MEMPTR;
case ROWID:
return ABLNodeType.ROWID;
case COMPONENT_HANDLE:
return ABLNodeType.COMHANDLE;
case TABLE:
return ABLNodeType.TABLE;
case TABLE_HANDLE:
return ABLNodeType.TABLEHANDLE;
case BLOB:
return ABLNodeType.BLOB;
case CLOB:
return ABLNodeType.CLOB;
case BYTE:
return ABLNodeType.BYTE;
case SHORT:
return ABLNodeType.SHORT;
case LONG:
return ABLNodeType.LONG;
case FLOAT:
return ABLNodeType.FLOAT;
case DOUBLE:
return ABLNodeType.DOUBLE;
case UNSIGNED_SHORT:
return ABLNodeType.UNSIGNEDSHORT;
case UNSIGNED_BYTE:
return ABLNodeType.UNSIGNEDBYTE;
case CURRENCY:
return ABLNodeType.CURRENCY;
case ERROR_CODE:
return ABLNodeType.ERRORCODE;
case FIXCHAR:
return ABLNodeType.FIXCHAR;
case BIGINT:
return ABLNodeType.BIGINT;
case TIME:
return ABLNodeType.TIME;
case DATETIME:
return ABLNodeType.DATETIME;
case DATASET:
return ABLNodeType.DATASET;
case DATASET_HANDLE:
return ABLNodeType.DATASETHANDLE;
case LONGCHAR:
return ABLNodeType.LONGCHAR;
case DATETIME_TZ:
return ABLNodeType.DATETIMETZ;
case INT64:
return ABLNodeType.INT64;
case UNSIGNED_INTEGER:
return ABLNodeType.UNSIGNEDINTEGER;
default:
return ABLNodeType.IUNKNOWN;
}
}

/**
* An AS phrase allows further abbreviations on the datatype names. Input a token's text, this returns 0 if it is not
* a datatype abbreviation, otherwise returns the integer token type for the abbreviation. Here's the normal keyword
Expand Down
7 changes: 7 additions & 0 deletions proparse/src/main/java/org/prorefactor/core/JPNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.prorefactor.core.nodetypes.IExpression;
import org.prorefactor.core.nodetypes.IStatement;
import org.prorefactor.core.nodetypes.IStatementBlock;
import org.prorefactor.core.nodetypes.IfStatementNode;
import org.prorefactor.core.nodetypes.InUIReferenceNode;
import org.prorefactor.core.nodetypes.LocalMethodCallNode;
import org.prorefactor.core.nodetypes.MethodCallNode;
Expand Down Expand Up @@ -1185,6 +1186,12 @@ private JPNode build(ParserSupport support, JPNode up, int num) {
case CANFIND:
node = new CanFindNode(tok, up, num, hasChildren);
break;
case IF:
if (stmt)
node = new IfStatementNode(tok, up, num, hasChildren);
else
node = new JPNode(tok, up, num, hasChildren);
break;
default:
if (stmt && block)
node = new StatementBlockNode(tok, up, num, hasChildren, stmt2, blockLabel);
Expand Down
Loading

0 comments on commit 98e8b7e

Please sign in to comment.