Skip to content

Commit ddb39dd

Browse files
authored
Merge pull request #545 from smeup/feature/LS24002974/except-mock-implementation
Feature/ls24002974/except mock implementation
2 parents 433e697 + e33ac4f commit ddb39dd

File tree

5 files changed

+39
-0
lines changed

5 files changed

+39
-0
lines changed

rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/parsing/ast/serialization.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ private val modules = SerializersModule {
6565
subclass(DowStmt::class)
6666
subclass(DOWxxStmt::class)
6767
subclass(EvalStmt::class)
68+
subclass(ExceptStmt::class)
6869
subclass(ExecuteSubroutine::class)
6970
subclass(ExfmtStmt::class)
7071
subclass(FeodStmt::class)

rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/parsing/ast/statements.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2410,6 +2410,19 @@ data class UnlockStmt(
24102410
override fun execute(interpreter: InterpreterCore) {}
24112411
}
24122412

2413+
@Serializable
2414+
data class ExceptStmt(
2415+
override val position: Position? = null
2416+
) : Statement(position) {
2417+
override val loggableEntityName: String
2418+
get() = "EXCEPT"
2419+
2420+
override fun execute(interpreter: InterpreterCore) {
2421+
// TODO: Replace with actual implementation
2422+
throw NotImplementedError("EXCEPT statement is not implemented yet")
2423+
}
2424+
}
2425+
24132426
@Serializable
24142427
data class FeodStmt(
24152428
override val position: Position? = null

rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/parsing/parsetreetoast/misc.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,9 @@ internal fun Cspec_fixed_standardContext.toAst(conf: ToAstConfiguration = ToAstC
962962
this.csUNLOCK() != null -> this.csUNLOCK()
963963
.let { it.cspec_fixed_standard_parts().validate(stmt = it.toAst(conf), conf = conf) }
964964

965+
this.csEXCEPT() != null -> this.csEXCEPT()
966+
.let { it.cspec_fixed_standard_parts().validate(stmt = it.toAst(conf), conf = conf) }
967+
965968
this.csFEOD() != null -> this.csFEOD()
966969
.let { it.cspec_fixed_standard_parts().validate(stmt = it.toAst(conf), conf = conf) }
967970

@@ -2093,6 +2096,12 @@ internal fun CsUNLOCKContext.toAst(conf: ToAstConfiguration = ToAstConfiguration
20932096
return UnlockStmt(position)
20942097
}
20952098

2099+
// TODO
2100+
internal fun CsEXCEPTContext.toAst(conf: ToAstConfiguration = ToAstConfiguration()): Statement {
2101+
val position = toPosition(conf.considerPosition)
2102+
return ExceptStmt(position)
2103+
}
2104+
20962105
internal fun CsTESTNContext.toAst(conf: ToAstConfiguration = ToAstConfiguration()): TestnStmt {
20972106
val position = toPosition(conf.considerPosition)
20982107
val resultExpression = this.cspec_fixed_standard_parts().resultExpression(conf) as AssignableExpression

rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/smeup/MULANGT10BaseCodopTest.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,14 @@ open class MULANGT10BaseCodopTest : MULANGTTest() {
122122
val expected = listOf("51=1,52=0,53=0")
123123
assertEquals(expected, "smeup/MU102501".outputOf())
124124
}
125+
126+
/**
127+
* EXCEPT statement is supported
128+
* @see #LS24002974
129+
*/
130+
@Test
131+
fun executeMUDRNRAPU00216() {
132+
val expected = listOf("ok")
133+
assertEquals(expected, "smeup/MUDRNRAPU00216".outputOf())
134+
}
125135
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
D £DBG_Str S 2
2+
C IF 0
3+
C EXCEPT E1RIGA
4+
C ENDIF
5+
C EVAL £DBG_Str='ok'
6+
C £DBG_Str DSPLY

0 commit comments

Comments
 (0)