Node
public protocol Node : CustomStringConvertible
Nodes are the basic elements of IntermediateRepresentation
s. They record a TokenType
, the range of the String
‘s UnicodeScalarView
the match occured in
as well as any annotations that were made on the token.
-
The token representing the match
Declaration
Swift
var token: TokenType { get }
-
The range of the match in the original source
Declaration
Swift
var range: Range<String.UnicodeScalarView.Index> { get }
-
Annotations that were made on the token
Declaration
Swift
var annotations: [RuleAnnotation : RuleAnnotationValue] { get }
-
Any sub-nodes in the tree
Declaration
Swift
var children: [Self] { get }
-
Create a new instance of the node
Parameter for: The token that has been matched Parameter range: The range of the match Parameter annotations: The annotations that were made on the token
Declaration
Swift
init(for token: TokenType, at range: Range<String.UnicodeScalarView.Index>, annotations: [RuleAnnotation : RuleAnnotationValue])
-
description
Extension methodA human readable description of the
Node
Declaration
Swift
public var description: String { get }