Enumerationswift-grammar 0.5.0Grammar
Collect
Pattern.swift:41enum Collect<Rule, Construction> where Rule : ParsingRule, Construction : RangeReplaceableCollection, Rule.Construction == Construction.Elementenum Collect<Rule, Construction> where Rule : ParsingRule, Construction : RangeReplaceableCollection, Rule.Construction == Construction.Elementimport Grammarenum PatternA namespace for structured parsing utilities.
protocol ParsingRule<Terminal>A structured parsing rule.
protocol RangeReplaceableCollection<Element> : Collection where Self.SubSequence : RangeReplaceableCollectionA collection that supports replacement of an arbitrary subrange of elements with the elements of another collection.
associatedtype ConstructionThe type of the constructions produced by a successful application of this parsing rule.
associatedtype Element where Self.Element == Self.Iterator.ElementA type representing the sequence’s elements.
enum Discard<Rule> where Rule : ParsingRule, Rule.Construction == ()A rule that unconditionally ignores all remaining input.
enum End<Location, Terminal>A rule that expects the end of the input.
@frozen struct IntegerOverflowError<Integer> where Integer : FixedWidthIntegerAn integer overflow error occurred while applying one of the built-in integer parsing rules.
enum Join<Rule, Separator, Construction> where Rule : ParsingRule, Separator : ParsingRule, Construction : RangeReplaceableCollection, Rule.Construction == Construction.Element, Rule.Location == Separator.Location, Rule.Terminal == Separator.Terminal, Separator.Construction == ()enum Pad<Rule, Padding> where Rule : ParsingRule, Padding : ParsingRule, Rule.Location == Padding.Location, Rule.Terminal == Padding.Terminal, Padding.Construction == ()enum Reduce<Rule, Construction> where Rule : ParsingRule, Construction : RangeReplaceableCollection, Rule.Construction == Construction.Element@frozen struct UnexpectedEndOfInputError@frozen struct UnexpectedValueErrorenum UnsignedNormalizedInteger<First, Next> where First : ParsingRule, Next : DigitRule, First.Construction : FixedWidthInteger, First.Construction == Next.Construction, First.Location == Next.Location, First.Terminal == Next.Terminaltypealias UnsignedInteger<Digit> = UnsignedNormalizedInteger<Digit, Digit> where Digit : DigitRule, Digit.Construction : FixedWidthIntegerstatic func parse<Source>(_ input: inout ParsingInput<some ParsingDiagnostics<Source>>) -> Construction where Rule.Location == Source.Index, Rule.Terminal == Source.Element typealias Location = Rule.Locationtypealias Terminal = Rule.Terminalstatic func parse<Source>(_ source: Source) throws -> Construction where Source : Collection, Self.Location == Source.Index, Self.Terminal == Source.Element Attempts to parse the given input completely.
static func parse<Source, Vector>(_ source: Source, into _: Vector.Type = Vector.self) throws -> Vector where Source : Collection, Vector : RangeReplaceableCollection, Self.Construction == Vector.Element, Self.Location == Source.Index, Self.Terminal == Source.Element Attempts to parse the given input completely by applying this rule repeatedly.
static func parse<Source>(diagnosing source: Source) throws -> Construction where Source : Collection, Self.Location == Source.Index, Self.Terminal == Source.Element Attempts to parse the given input completely, emitting diagnostics if parsing failed.