Skip to content

Commit ef9f4f8

Browse files
committed
feat: remove case colons
1 parent f5e3c6b commit ef9f4f8

8 files changed

Lines changed: 29 additions & 45 deletions

File tree

language/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "0.0.24",
2+
"version": "0.0.25",
33
"name": "bcs-engineering-dsl",
44
"displayName": "BCS Engineering DSL",
55
"icon": "icon.png",

language/railroad/svg/bcs-control/CaseOption.svg

Lines changed: 7 additions & 15 deletions
Loading

language/railroad/svg/bcs-control/DefaultOption.svg

Lines changed: 7 additions & 15 deletions
Loading

language/src/language/bcs-control.langium

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,11 @@ SwitchStmt:
200200
;
201201

202202
CaseOption:
203-
'case' (literals+=CaseLiteral (',' literals+=CaseLiteral)*) ':' Block
203+
'case' (literals+=CaseLiteral (',' literals+=CaseLiteral)*) Block
204204
;
205205

206206
DefaultOption:
207-
'default' ':' Block
207+
'default' Block
208208
;
209209

210210
ExpressionStmt:

language/test/generating/nested_control_test/input/nested_control_test.bcsctrl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,19 @@ control NestedControlTestController {
4343

4444
// Different processing based on state
4545
switch (iState) {
46-
case ProcessState.INIT: {
46+
case ProcessState.INIT {
4747
// Initialization processing
4848
tempSum = tempSum + iValues[i] * 0.8;
4949
}
50-
case ProcessState.PROCESSING: {
50+
case ProcessState.PROCESSING {
5151
// Normal processing - with nested if
5252
if (iValues[i] > iThreshold * 2.0) {
5353
tempSum = tempSum + iValues[i] * 1.5;
5454
} else {
5555
tempSum = tempSum + iValues[i];
5656
}
5757
}
58-
default: {
58+
default {
5959
// Should not happen, but handle anyway
6060
tempSum = tempSum + iValues[i] * 0.5;
6161
}

language/test/generating/switch_test/input/switch_test.bcsctrl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,22 @@ control SwitchTestController {
2424
adjustedTemp = iTemperature * 1.05;
2525

2626
switch (iMode) {
27-
case OperationMode.IDLE: {
27+
case OperationMode.IDLE {
2828
oHeatingValue = 0.0;
2929
oCoolingValue = 0.0;
3030
oStatusMessage = "System idle";
3131
}
32-
case OperationMode.HEATING: {
32+
case OperationMode.HEATING {
3333
oHeatingValue = adjustedTemp;
3434
oCoolingValue = 0.0;
3535
oStatusMessage = "Heating active";
3636
}
37-
case OperationMode.COOLING: {
37+
case OperationMode.COOLING {
3838
oHeatingValue = 0.0;
3939
oCoolingValue = adjustedTemp;
4040
oStatusMessage = "Cooling active";
4141
}
42-
default: {
42+
default {
4343
oHeatingValue = 0.0;
4444
oCoolingValue = 0.0;
4545
oStatusMessage = "Error state";

language/test/validating/files/invalid_switch/control_switch.bcsctrl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,23 @@ control InvalidSwitchTestController {
1212
unit TestUnit {
1313
var status_should_fail: Status; // Moved to unit level
1414
switch (mode_should_fail){
15-
case Status.OFF:{
15+
case Status.OFF{
1616
// Nested variable declarations no longer allowed
1717
status_should_fail = Status.ON;
1818
}
19-
case Mode.ECO:{
19+
case Mode.ECO{
2020
// Nested variable declarations no longer allowed
2121
status_should_fail = Status.OFF;
2222
}
23-
case Mode.ECO:{
23+
case Mode.ECO{
2424
// Nested variable declarations no longer allowed
2525
status_should_fail = Status.ON;
2626
}
27-
case true:{
27+
case true{
2828
// Nested variable declarations no longer allowed
2929
status_should_fail = Status.OFF;
3030
}
31-
default:{
31+
default{
3232
// Nested variable declarations no longer allowed
3333
status_should_fail = Status.ON;
3434
}

0 commit comments

Comments
 (0)