Skip to content

RuleScript v1.3.0

Choose a tag to compare

@github-actions github-actions released this 30 Jun 15:29
· 90 commits to main since this release

RuleScript v1.3.0

Highlights

RuleScript v1.3.0 adds non-fallthrough switch statements, multi-value and guarded cases, a script-level null literal, and switch-specific semantic diagnostics while preserving existing script and host API compatibility.

switch status:
    case "ok":
        result = "Continue";
    case "warning", "error" when retryCount <= 3:
        result = "Inspect";
    case "warning" when retryCount > 3:
        result = "Escalate";
    case null:
        result = "Missing status";
    default:
        result = "Unknown status";
endswitch

Switch Behavior

  • The switch expression is evaluated exactly once.
  • The first eligible case executes once without fallthrough; break is not required.
  • Comma-separated labels and consecutive empty labels can share a body.
  • A when guard runs only after its label matches and must evaluate to bool.
  • default is optional, unique, and must be last.
  • end can replace endswitch.
  • Synchronous and asynchronous execution are supported.

Analysis and Public API

  • Added RuleScriptDiagnosticCodes.DuplicateCase (RS2006).
  • Added RuleScriptDiagnosticCodes.MissingDefaultBranch (RS2007).
  • Added switch/case type compatibility and guard-type analysis.
  • Added public SwitchStatement, SwitchCase, and SwitchLabel AST records.
  • Added Null, Switch, Case, Default, When, and EndSwitch token types.
  • Updated symbol collection for variables declared in case and default bodies.

Compatibility

Existing scripts and v1.2.0 host integrations remain compatible unless a script used a newly reserved word as an identifier. New reserved words are switch, case, default, when, endswitch, and null.

Validation

  • Release build: 0 warnings and 0 errors.
  • Test suite: 399 passed, 0 failed, 0 skipped.
  • Package version: 1.3.0.

For complete syntax and API documentation, see the Language Guide, Debugging and Analysis, and API Reference by Class.