-
Annotations for the rule
Declaration
Swift
public let annotations: RuleAnnotations
-
Behaviour for the rule
Declaration
Swift
public let behaviour: Behaviour
-
Create a an instance supplied annotations and token that will use the supplied
Test
closure to perform its matchDeclaration
Swift
public init(with behaviour:Behaviour, and annotations:RuleAnnotations = [:], using matcher:@escaping Test)
-
This function should create a new instance of this rule, replacing the behaviour and any annotations with those specified in the parameters if not nil, or maintaining the current ones if nil.
Declaration
Swift
public func rule(with behaviour: Behaviour? = nil, annotations: RuleAnnotations? = nil) -> Rule
Parameters
behaviour
The behaviour for the new instance, if nil the new copy should use the same behaviour as this instance.
annotations
The annotations for the new instance, if nil the new copy should use the same behaviour as this instance.
Return Value
A new instance with the specified behaviour and annotations.
-
This function implements the actual test. It is responsible soley for performing the test. The scanner head will be managed correctly based on success (it will be left in the position at the end of the test), or returned to its pre-test position on failure.
Declaration
Swift
public func test(with lexer: LexicalAnalyzer, for ir: IntermediateRepresentation) throws
Parameters
lexer
The lexer controlling the scanner
ir
The intermediate representation
-
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 }