Skip to content

Commit

Permalink
Merge branch 'release/1.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
lanarimarco committed Mar 28, 2024
2 parents 4e33d94 + b9a2c1c commit 3ffcb2d
Show file tree
Hide file tree
Showing 229 changed files with 9,144 additions and 564 deletions.
11 changes: 0 additions & 11 deletions .circleci/config.yml

This file was deleted.

7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
21 changes: 0 additions & 21 deletions .github/workflows/build.yml

This file was deleted.

10 changes: 5 additions & 5 deletions .github/workflows/publish-smeup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 11
distribution: zulu
- uses: gradle/actions/setup-gradle@v3
# save private key to file (private.gpg)
- run: echo "${{ secrets.GPG_KEY_BASE64 }}" | base64 -d > ~/private.gpg
# create gradle.properties file
Expand All @@ -23,6 +25,4 @@ jobs:
echo "smeupUsername=${{ secrets.NEXUS_USER }}" >> ~/.gradle/gradle.properties
echo "smeupPassword=${{ secrets.NEXUS_PASSWORD }}" >> ~/.gradle/gradle.properties
# deploy
- uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
with:
arguments: publishToSmeup
- run: ./gradlew publishToSmeup
10 changes: 5 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 11
distribution: zulu
- uses: gradle/actions/setup-gradle@v3
# save private key to file (private.gpg)
- run: echo "${{ secrets.GPG_KEY_BASE64 }}" | base64 -d > ~/private.gpg
# create gradle.properties file
Expand All @@ -24,6 +26,4 @@ jobs:
echo "sonatypeUsername=${{ secrets.OSSRH_USERNAME }}" >> ~/.gradle/gradle.properties
echo "sonatypePassword=${{ secrets.OSSRH_PASSWORD }}" >> ~/.gradle/gradle.properties
# deploy
- uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
with:
arguments: publishToSonatype closeAndReleaseSonatypeStagingRepository
- run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
22 changes: 22 additions & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Unit Test

on:
pull_request:
branches:
- master
- develop

jobs:
unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 11
distribution: zulu
- uses: gradle/actions/setup-gradle@v3
- name: Checking kotlin formatting
run: ./gradlew ktlintCheck
- name: Compiling and test
run: ./gradlew check
2 changes: 1 addition & 1 deletion docs/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# default code owners
* [email protected] [email protected] [email protected] [email protected]
* [email protected] [email protected] [email protected] [email protected] [email protected]
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ serializationVersion=1.5.0
jvmVersion=11
reloadVersion=v1.3.2
jarikoGroupId=io.github.smeup.jariko
jarikoVersion=v1.3.0
jarikoVersion=v1.4.0
21 changes: 15 additions & 6 deletions rpgJavaInterpreter-core/src/main/antlr/RpgLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,15 @@ fragment DECIMAL_SEPARATOR : [.,];
NUMBER : ([0-9]+(DECIMAL_SEPARATOR[0-9]*)?) | DECIMAL_SEPARATOR[0-9]+ ;
SEMI : ';';
COLON : ':';
ID : ('*' {getCharPositionInLine()>7}? '*'? [a-zA-Z])?
[§£#@%$a-zA-Z]{getCharPositionInLine()>7}? [§£#@$a-zA-Z0-9_]* ;
ID : ({
_input.LA(-1) == 32 ||
_input.LA(-1) == '(' ||
_input.LA(-1) == '*' ||
_input.LA(-1) == '+' ||
_input.LA(-1) == '/' ||
_input.LA(-1) == '='
}? '*' {getCharPositionInLine()>7}? '*' ? [a-zA-Z])?
[§£#@%$a-zA-Z]{getCharPositionInLine()>7}? [§£#@$a-zA-Z0-9_]*;
NEWLINE : (('\r'? '\n')|'\r') -> skip;
WS : [ \t] {getCharPositionInLine()>6}? [ \t]* -> skip ; // skip spaces, tabs

Expand Down Expand Up @@ -316,9 +323,9 @@ SPLAT_FILE: '*'[fF][iI][lL][eE];
SPLAT_GETIN: '*'[gG][eE][tT][iI][nN];
SPLAT_HIVAL: '*'[hH][iI][vV][aA][lL];
SPLAT_INIT: '*'[iI][nN][iI][tT];
SPLAT_ALL_INDICATORS: '*' [iI] [nN] [ ] [ ];
SPLAT_INDICATOR : ( '*' [iI] [nN] [0-9] [0-9]
| '*' [iI] [nN] [a-zA-Z] [a-zA-Z]
| '*' [iI] [nN] '(' [0-9] [0-9] ')' );
| '*' [iI] [nN] [a-zA-Z] [a-zA-Z] );
SPLAT_INZSR: '*'[iI][nN][zZ][sS][rR];
SPLAT_IN: '*'[iI][nN];
SPLAT_INPUT: '*'[iI][nN][pP][uU][tT];
Expand Down Expand Up @@ -510,8 +517,8 @@ PLUS : '+' ;
MINUS : '-' ;
EXP : '**' ;
ARRAY_REPEAT: {_input.LA(2) == ')' && _input.LA(-1) == '('}? '*' ;
MULT_NOSPACE: {_input.LA(2) != 32}? '*';
MULT: {_input.LA(2) == 32}? '*' ;
MULT_NOSPACE: {_input.LA(2) != 32 || _input.LA(-1) != 32}? '*';
MULT: {_input.LA(2) == 32 && _input.LA(-1) == 32}? '*' ;
DIV : '/' ;

// Assignment Operators
Expand Down Expand Up @@ -1032,6 +1039,7 @@ CS_Factor2_SPLAT_GETIN : SPLAT_GETIN {35+6<= getCharPositionInLine() && getCharP
CS_Factor2_SPLAT_HIVAL : SPLAT_HIVAL {35+6<= getCharPositionInLine() && getCharPositionInLine()<=48}? -> type(SPLAT_HIVAL);
CS_Factor2_SPLAT_INIT : SPLAT_INIT {35+5<= getCharPositionInLine() && getCharPositionInLine()<=48}? -> type(SPLAT_INIT);
CS_Factor2_SPLAT_INDICATOR : SPLAT_INDICATOR {35+4<= getCharPositionInLine() && getCharPositionInLine()<=48}? -> type(SPLAT_INDICATOR);
CS_Factor2_SPLAT_ALL_INDICATORS : SPLAT_ALL_INDICATORS {35+4<= getCharPositionInLine() && getCharPositionInLine()<=48}? -> type(SPLAT_ALL_INDICATORS);
CS_Factor2_SPLAT_INZSR : SPLAT_INZSR {35+6<= getCharPositionInLine() && getCharPositionInLine()<=48}? -> type(SPLAT_INZSR);
CS_Factor2_SPLAT_IN : SPLAT_IN {35+3<= getCharPositionInLine() && getCharPositionInLine()<=48}? -> type(SPLAT_IN);
CS_Factor2_SPLAT_JOBRUN : SPLAT_JOBRUN {35+7<= getCharPositionInLine() && getCharPositionInLine()<=48}? -> type(SPLAT_JOBRUN);
Expand Down Expand Up @@ -1163,6 +1171,7 @@ CS_FactorContent: (~[\r\n' :]
|| (getCharPositionInLine()>=36 && getCharPositionInLine()<=49)
}?
)+;
CS_FactorContentArrayIndexing: (CS_ResultContent | CS_FactorContent) WS* OPEN_PAREN (CS_ResultContent | CS_FactorContent) CLOSE_PAREN {setText(getText().replaceAll("\\s", ""));};
CS_ResultContent: (~[\r\n' :]
{(getCharPositionInLine()>=50 && getCharPositionInLine()<=63)}?
)+ -> type(CS_FactorContent);
Expand Down
43 changes: 33 additions & 10 deletions rpgJavaInterpreter-core/src/main/antlr/RpgParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -317,19 +317,39 @@ elseClause:
;

casestatement:
((CS_FIXED
(
csCASxx+
csCASother?
casestatementend
) | (
csCASother
casestatementend
)
;

csCASxx:
CS_FIXED
cspec_continuedIndicators*
cs_controlLevel
indicatorsOff=onOffIndicatorsFlag indicators=cs_indicators factor1=factor)
(csCASEQ
cs_controlLevel
indicatorsOff=onOffIndicatorsFlag indicators=cs_indicators factor1=factor
(csCASEQ
| csCASNE
| csCASLE
| csCASLT
| csCASGE
| csCASGT
| csCAS))+
casestatementend
| csCASGT)
;

csCASother:
(CS_FIXED
cspec_continuedIndicators*
cs_controlLevel
indicatorsOff=onOffIndicatorsFlag indicators=cs_indicators factor1=factor
csCAS
)
| (op_other FREE_SEMI free_linecomments? )
;

casestatementend:
CS_FIXED
cspec_continuedIndicators*
Expand Down Expand Up @@ -1481,8 +1501,8 @@ csMULT:
csMVR:
CS_FIXED
BlankIndicator
BlankFlag
BlankIndicator
(BlankFlag | NoFlag)
(BlankIndicator | GeneralIndicator)
CS_BlankFactor
operation=OP_MVR
cspec_fixed_standard_parts;
Expand Down Expand Up @@ -1722,7 +1742,7 @@ factorContent:
CS_FactorContent | literal;

resultType:
CS_FactorContent (COLON (constant=symbolicConstants))? | CS_BlankFactor;
(CS_FactorContentArrayIndexing | CS_FactorContent) (COLON (constant=symbolicConstants))? | CS_BlankFactor;
cs_fixed_comments:CS_FixedComments;
//cs_fixed_x2: CS_OperationAndExtendedFactor2 C2_FACTOR2_CONT* C2_FACTOR2 C_EOL;
cspec_fixed_x2:
Expand Down Expand Up @@ -2581,6 +2601,7 @@ SPLAT_ALL
| SPLAT_HIVAL
| SPLAT_INIT
| SPLAT_INDICATOR
| SPLAT_ALL_INDICATORS
| SPLAT_INZSR
| SPLAT_IN
| SPLAT_JOBRUN
Expand Down Expand Up @@ -2643,7 +2664,9 @@ target:
| base=target OPEN_PAREN index=expression CLOSE_PAREN #indexedTarget
| bif_subst #substTarget
| bif_subarr #subarrTarget
| bif_len #lenTarget
| container=idOrKeyword DOT fieldName=idOrKeyword #qualifiedTarget
| indic=SPLAT_INDICATOR #indicatorTarget
| base=SPLAT_IN OPEN_PAREN index=expression CLOSE_PAREN #indexedIndicatorTarget
| SPLAT_IN #globalIndicatorTarget
;
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package com.smeup.rpgparser.execution
import com.smeup.dbnative.DBNativeAccessConfig
import com.smeup.rpgparser.interpreter.*
import com.smeup.rpgparser.parsing.ast.CompilationUnit
import com.smeup.rpgparser.parsing.ast.MockStatement
import com.smeup.rpgparser.parsing.facade.CopyBlocks
import com.smeup.rpgparser.parsing.facade.CopyId
import com.smeup.rpgparser.parsing.facade.SourceReference
Expand Down Expand Up @@ -162,7 +163,12 @@ data class JarikoCallback(
},
var onCallPgmError: (errorEvent: ErrorEvent) -> Unit = { },
var logInfo: ((channel: String, message: String) -> Unit)? = null,
var channelLoggingEnabled: ((channel: String) -> Boolean)? = null
var channelLoggingEnabled: ((channel: String) -> Boolean)? = null,
/**
* This is called for those statements mocked.
* @param mockStatement "Statement" where is get its name for the `println`.
*/
var onMockStatement: ((mockStatement: MockStatement) -> Unit) = { System.err.println("Executing mock: ${it.javaClass.simpleName}") }
)

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import com.smeup.rpgparser.interpreter.*
* Data are stored IntArrayMap, which is a more efficient map than standard ones
* @see IntArrayMap
* */
@Deprecated("This class is experimental and will be removed in future versions. Use com.smeup.rpgparser.interpreter.SymbolTable instead.")
class SymbolTable : ISymbolTable {
private val values = IntArrayMap<Pair<AbstractDataDefinition, Value>>(0, 32000)
private val names = mutableMapOf<String, AbstractDataDefinition>()
Expand All @@ -34,10 +35,10 @@ class SymbolTable : ISymbolTable {
override var parentSymbolTable: ISymbolTable? = null

override operator fun get(data: AbstractDataDefinition): Value {
return when (data.scope) {
Scope.Program -> (programSymbolTable as SymbolTable).getLocal(data)
Scope.Local -> getLocal(data)
Scope.Static -> TODO()
return when (data.scope.visibility) {
Visibility.Program -> (programSymbolTable as SymbolTable).getLocal(data)
Visibility.Local -> getLocal(data)
Visibility.Static -> TODO()
}
}

Expand Down Expand Up @@ -92,10 +93,10 @@ class SymbolTable : ISymbolTable {
}

override operator fun set(data: AbstractDataDefinition, value: Value): Value? {
return when (data.scope) {
Scope.Program -> (programSymbolTable as SymbolTable).setLocal(data, value)
Scope.Local -> setLocal(data, value)
Scope.Static -> TODO()
return when (data.scope.visibility) {
Visibility.Program -> (programSymbolTable as SymbolTable).setLocal(data, value)
Visibility.Local -> setLocal(data, value)
Visibility.Static -> TODO()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ interface Evaluator {
fun eval(expression: NotExpr): BooleanValue
fun eval(expression: ScanExpr): Value
fun eval(expression: SubstExpr): Value
fun eval(expression: CheckExpr): Value
fun eval(expression: SubarrExpr): Value
fun eval(expression: LenExpr): Value
fun eval(expression: OffRefExpr): BooleanValue
Expand All @@ -60,6 +61,7 @@ interface Evaluator {
fun eval(expression: EditcExpr): Value
fun eval(expression: DiffExpr): Value
fun eval(expression: DivExpr): Value
fun eval(expression: NegationExpr): Value
fun eval(expression: ExpExpr): Value
fun eval(expression: TrimrExpr): Value
fun eval(expression: TrimlExpr): Value
Expand All @@ -70,6 +72,7 @@ interface Evaluator {
fun eval(expression: AbsExpr): Value
fun eval(expression: EditwExpr): Value
fun eval(expression: IntExpr): Value
fun eval(expression: InthExpr): Value
fun eval(expression: RemExpr): Value
fun eval(expression: QualifiedAccessExpr): Value
fun eval(expression: ReplaceExpr): Value
Expand Down
Loading

0 comments on commit 3ffcb2d

Please sign in to comment.