Functions

The following functions are available globally.

  • Creates a new instance of the rule set to have lookahead behaviour

    // Creates a lookahead version of of the rule let lookahead = >>CharacterSet.letters.skip()

    Declaration

    Swift

    public prefix func >> (rule: Rule) -> Rule

    Parameters

    rule

    The rule to apply to

    Return Value

    A new version of the rule

  • Creates a new instance of the rule which negates its match. Note that negate does not toggle, that is !!rule != rule

    // Creates a negated version of of the rule let notLetter = !CharacterSet.letters.skip()

    Declaration

    Swift

    public prefix func ! (rule: Rule) -> Rule

    Parameters

    rule

    The rule to apply to

    Return Value

    A new version of the rule

  • Creates a new instance of the rule which skips.

    // Creates a skipping version of of the rule let skippingRule = -scanningRule

    Declaration

    Swift

    public prefix func - (rule: Rule) -> Rule

    Parameters

    rule

    The rule to apply to

    Return Value

    A new version of the rule

  • Creates a new instance of the rule which scans.

    // Creates a scanning version of of the rule let scanningRule = ~parsingRule

    Declaration

    Swift

    public prefix func ~ (rule: Rule) -> Rule

    Parameters

    rule

    The rule to apply to

    Return Value

    A new version of the rule