ParsingRule
A structured parsing rule.
ParsingRule.swift:3protocol ParsingRule<Terminal>
Requirements
associatedtype Construction
The type of the constructions produced by a successful application of this parsing rule.
associatedtype Location
The index type of the
ParsingInput.source
this rule expects.associatedtype Terminal
The element type of the
ParsingInput.source
this rule expects.static func parse<Source>(inout ParsingInput
<some ParsingDiagnostics>) throws -> Self.Construction Attempts to parse an instance of
Construction
from the given parsing input.
Citizens in Grammar
Members
static func parse<Source, Vector>(Source, into: Vector.Type
) throws -> Vector Attempts to parse the given input completely by applying this rule repeatedly.
static func parse<Source>(diagnosing: Source
) throws -> Self.Construction Attempts to parse the given input completely, emitting diagnostics if parsing failed.
Subtypes
protocol AtomicRule
A parsing rule that matches terminals against a constant value.
protocol DigitRule
A parsing rule that is applied to a single terminal at a time, and produces some
BinaryInteger
as its output.protocol LiteralRule
A parsing rule that matches terminals against a constant
Sequence
.protocol TerminalRule
A parsing rule that is applied to a single terminal at a time.