Skip to content

Validate range expressions #25

@nathcouret

Description

@nathcouret

Add checks in range expression that the left operand is "less" than the right operand.

  • specify an error message for range bounds validation
  • (Optional) Add recovery behaviour

Sample code

const invalidResult = cronix("0 20-4 * * *");
// should be null
console.log(invalidResult.ast.value());
// Should have 1 error at semantic step with invalid range bounds
console.log(invalidResult.errors[1]);

Recovery behaviour

In the above snippet, we assume the user actually meant 4-20 instead of 20-4. Therefore the parser should be able to identify such mistake and accordingly fix it if the user desires it. That behaviour can be enabled via a flag in the parser's options.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions