TerminalRule

public final class TerminalRule : Rule

A rule that matches the specified Terminal

  • The behaviour of the rule

    Declaration

    Swift

    public var behaviour: Behaviour
  • Annotations on the rule

    Declaration

    Swift

    public var annotations: RuleAnnotations
  • The acceptable matches that would satisfy this rule

    Declaration

    Swift

    public var terminal: Terminal
  • Creates a new instance of the rule with the specified parameteres.

    Declaration

    Swift

    public init(_ behaviour: Behaviour, and annotations: RuleAnnotations, for terminal: Terminal)

    Parameters

    behaviour

    The Behaviour for the rule

    annotations

    The RuleAnnotations on the rule

    terminal

    The Terminal terminal

  • Tests the specified terminal exists at the scanner head

    Declaration

    Swift

    public func test(with lexer: LexicalAnalyzer, for ir: IntermediateRepresentation) throws

    Parameters

    lexer

    The LexicalAnalyzer managing the scan head

    ir

    The IR building the AST

  • Creates a new instance with the specified behaviour and annoations overriding the current instance’s if specified

    Declaration

    Swift

    public func rule(with behaviour: Behaviour? = nil, annotations: RuleAnnotations? = nil) -> Rule

    Parameters

    behaviour

    If specified will replace this instance’s behaviour in the new instance

    annotations

    If specified will replace this instance’s annotations in the new instance

  • A textual description of the rule

    Declaration

    Swift

    public var description: String { get }
  • An abreviated description of the rule

    Declaration

    Swift

    public var shortDescription: String { get }