Parser
public enum Parser : Sendable
Notes:
Be careful when writing rules that start with an optional symbol that may be recognized at the beginning of the following construct. A naive combinator may not be able to backtrack. For example:
let p0 = maybe(foo.and(bar)).and(ham)
let p1 = foo.and(bar).or(ham)
Both p0 and p1 will fail to recognize inputs recognized by ham if foo can recognize
the same prefix, as the latter will throw a committing failure it applies bar rather than
backtracking. A correct definition is:
let p2 = attempt(foo.and(bar)).or(foo)
A namespace for the routines of Hylo’s parser.
-
Parses the contents of
inputas a translation unit, registering the identities of newly formed ASTs in spacekand reporting errors todiagnostics.Throws
Diagnostics if syntax errors were encountered.Declaration
Swift
public static func parse( _ input: SourceFile, inNodeSpace k: Int, in ast: inout AST, diagnostics: inout DiagnosticSet ) throws -> TranslationUnit.ID -
Fails the parsing of the expected construct with the given diagnostic.
Declaration
Swift
private static func fail(_ d: Diagnostic) throws -> Never -
Fails the parsing of the expected construct with the given diagnostics.
Declaration
Swift
private static func fail<C>(_ ds: C) throws -> Never where C : Collection, C.Element == Diagnostic
-
Parses a declaration prologue in
stateand then callscontinuation.Declaration
Swift
static func parseDeclPrologue<R>( in state: inout ParserState, then continuation: (_ prologue: DeclPrologue, _ state: inout ParserState) throws -> R? ) throws -> R? -
Parses a declaration in
See morestate.Declaration
Swift
static func parseDecl(in state: inout ParserState) throws -> AnyDeclID? -
Parses the body of a type declaration, adding
contexttostate.contextswhile parsing each member declaration.Note
The function never returns a soft failure. It will throw if it can’t parse the left brace of the body, even if it didn’t consume any token from the stream.
Declaration
Swift
private static func parseTypeDeclBody( in state: inout ParserState, wrappedIn context: ParserState.Context ) throws -> [AnyDeclID]Parameters
stateA mutable projection of the parser’s state.
contextThe parser context in which members should be parsed.
-
Parses an instance of
AssociatedTypeDecl.Declaration
Swift
static func parseAssociatedTypeDecl( withPrologue prologue: DeclPrologue, in state: inout ParserState ) throws -> AssociatedTypeDecl.ID? -
Parses an instance of
AssociatedValueDecl.Declaration
Swift
static func parseAssociatedValueDecl( withPrologue prologue: DeclPrologue, in state: inout ParserState ) throws -> AssociatedValueDecl.ID? -
Parses a declaration of bindings.
Declaration
Swift
private static func parseBindingDecl(in state: inout ParserState) throws -> BindingDecl.ID? -
Parses a declaration of bindings prefixed by the given (already parsed)
prologue.Declaration
Swift
static func parseBindingDecl( withPrologue prologue: DeclPrologue, in state: inout ParserState ) throws -> BindingDecl.ID? -
Parses an instance of
ConformanceDecl.Declaration
Swift
static func parseConformanceDecl( withPrologue prologue: DeclPrologue, in state: inout ParserState ) throws -> ConformanceDecl.ID? -
Parses an instance of
ExtensionDecl.Declaration
Swift
static func parseExtensionDecl( withPrologue prologue: DeclPrologue, in state: inout ParserState ) throws -> ExtensionDecl.ID? -
Parses an instance of
FunctionDeclorMethodDecl.Declaration
Swift
static func parseFunctionOrMethodDecl( withPrologue prologue: DeclPrologue, in state: inout ParserState ) throws -> AnyDeclID? -
Builds a new instance of
FunctionDeclfrom its parsed parts.Declaration
Swift
private static func buildFunctionDecl( prologue: DeclPrologue, head: FunctionDeclHead, signature: FunctionDeclSignature, body: FunctionBody?, in state: inout ParserState ) throws -> FunctionDecl.ID -
Builds a new instance of
Methodfrom its parsed parts.Declaration
Swift
private static func buildMethodDecl( prologue: DeclPrologue, head: FunctionDeclHead, signature: FunctionDeclSignature, impls: [MethodImpl.ID], in state: inout ParserState ) throws -> MethodDecl.ID -
Parses an instance of
ImportDecl.Declaration
Swift
static func parseImportDecl( withPrologue prologue: DeclPrologue, in state: inout ParserState ) throws -> ImportDecl.ID? -
Parses an instance of
InitializerDecl.Declaration
Swift
static func parseInitDecl( withPrologue prologue: DeclPrologue, in state: inout ParserState ) throws -> InitializerDecl.ID? -
Parses an instance of
InitializerDecl.Declaration
Swift
static func parseMemberwiseInitDecl( withPrologue prologue: DeclPrologue, in state: inout ParserState ) throws -> InitializerDecl.ID? -
Parses an instance of
NamespaceDecl.Declaration
Swift
static func parseNamespaceDecl( withPrologue prologue: DeclPrologue, in state: inout ParserState ) throws -> NamespaceDecl.ID? -
Parses an instance of
OperatorDecl.Declaration
Swift
static func parseOperatorDecl( withPrologue prologue: DeclPrologue, in state: inout ParserState ) throws -> OperatorDecl.ID? -
Parses an instance of
SubscriptDeclrepresenting a property declaration.Declaration
Swift
static func parsePropertyDecl( withPrologue prologue: DeclPrologue, in state: inout ParserState ) throws -> SubscriptDecl.ID? -
Parses an instance of
SubscriptDecl.Declaration
Swift
static func parseSubscriptDecl( withPrologue prologue: DeclPrologue, in state: inout ParserState ) throws -> SubscriptDecl.ID? -
Undocumented
Declaration
Swift
static func parseSubscriptDeclBody( in state: inout ParserState, asNonStaticMember isNonStaticMember: Bool ) throws -> [SubscriptImpl.ID]? -
Inserts a subscript having the given
introducerandbodyintostate.astand returns its ID.Requires
ifintroducerisnil, body is non-nil.Declaration
Swift
private static func buildSubscriptImpl( in state: inout ParserState, introducedBy introducer: SourceRepresentable<AccessEffect>, body: FunctionBody?, asNonStaticMember isNonStaticMember: Bool ) throws -> SubscriptImpl.IDParameters
introducerThe introducer of the declaration, or
nilif it is implicit. In that case, it is synthesized aslet.bodyThe body of the declaration, or
nilif that body should must be synthesized or if the declaration denotes a trait requirement. -
Parses an instance of
TraitDecl.Declaration
Swift
static func parseTraitDecl( withPrologue prologue: DeclPrologue, in state: inout ParserState ) throws -> TraitDecl.ID? -
Parses an instance of
ProductTypeDecl.Declaration
Swift
static func parseProductTypeDecl( withPrologue prologue: DeclPrologue, in state: inout ParserState ) throws -> ProductTypeDecl.ID? -
Parses an instance of
TypeAliasDecl.Declaration
Swift
static func parseTypeAliasDecl( withPrologue prologue: DeclPrologue, in state: inout ParserState ) throws -> TypeAliasDecl.ID? -
Returns the access modifier in
prologueif in contains one, or synthesizes an implicit one.Declaration
Swift
private static func declAccessModifier( ofDeclPrologue prologue: DeclPrologue, in state: inout ParserState ) -> SourceRepresentable<AccessModifier> -
Undocumented
Declaration
Swift
static func parseFunctionDeclHead( in state: inout ParserState ) throws -> FunctionDeclHead? -
Undocumented
Declaration
Swift
static func parseFunctionDeclSignature( in state: inout ParserState ) throws -> FunctionDeclSignature? -
Undocumented
Declaration
Swift
private static let functionOrMethodDeclBody: TryCatch<Transform<Transform<Combine<Combine<TakeKind, OneOrMany<Transform<Combine<Apply<ParserState, SourceRepresentable<AccessEffect>>, Maybe<WrapInContext<TryCatch<Transform<Combine<Combine<TakeKind, Apply<ParserState, AnyExprID>>, TakeKind>, FunctionBody>, Transform<Transform<Combine<Combine<Combine<TakeKind, ZeroOrMany<TakeKind>>, ZeroOrMany<Apply<ParserState, AnyStmtID>>>, TakeKind>, BraceStmt.ID>, FunctionBody>>>>>, MethodImpl.ID>>>, TakeKind>, [MethodImpl.ID]>, FunctionOrMethodDeclBody>, Transform<WrapInContext<TryCatch<Transform<Combine<Combine<TakeKind, Apply<ParserState, AnyExprID>>, TakeKind>, FunctionBody>, Transform<Transform<Combine<Combine<Combine<TakeKind, ZeroOrMany<TakeKind>>, ZeroOrMany<Apply<ParserState, AnyStmtID>>>, TakeKind>, BraceStmt.ID>, FunctionBody>>>, FunctionOrMethodDeclBody>> -
Undocumented
Declaration
Swift
static let functionBody: WrapInContext<TryCatch<Transform<Combine<Combine<TakeKind, Apply<ParserState, AnyExprID>>, TakeKind>, FunctionBody>, Transform<Transform<Combine<Combine<Combine<TakeKind, ZeroOrMany<TakeKind>>, ZeroOrMany<Apply<ParserState, AnyStmtID>>>, TakeKind>, BraceStmt.ID>, FunctionBody>>> -
Undocumented
Declaration
Swift
static let methodDeclBody: Transform<Combine<Combine<TakeKind, OneOrMany<Transform<Combine<Apply<ParserState, SourceRepresentable<AccessEffect>>, Maybe<WrapInContext<TryCatch<Transform<Combine<Combine<TakeKind, Apply<ParserState, AnyExprID>>, TakeKind>, FunctionBody>, Transform<Transform<Combine<Combine<Combine<TakeKind, ZeroOrMany<TakeKind>>, ZeroOrMany<Apply<ParserState, AnyStmtID>>>, TakeKind>, BraceStmt.ID>, FunctionBody>>>>>, MethodImpl.ID>>>, TakeKind>, [MethodImpl.ID]> -
Undocumented
Declaration
Swift
static let methodImpl: Transform<Combine<Apply<ParserState, SourceRepresentable<AccessEffect>>, Maybe<WrapInContext<TryCatch<Transform<Combine<Combine<TakeKind, Apply<ParserState, AnyExprID>>, TakeKind>, FunctionBody>, Transform<Transform<Combine<Combine<Combine<TakeKind, ZeroOrMany<TakeKind>>, ZeroOrMany<Apply<ParserState, AnyStmtID>>>, TakeKind>, BraceStmt.ID>, FunctionBody>>>>>, MethodImpl.ID> -
Undocumented
Declaration
Swift
static let implIntroducer: Apply<ParserState, SourceRepresentable<AccessEffect>> -
Undocumented
Declaration
Swift
static let initDeclBody: WrapInContext<Transform<Combine<Combine<Combine<TakeKind, ZeroOrMany<TakeKind>>, ZeroOrMany<Apply<ParserState, AnyStmtID>>>, TakeKind>, BraceStmt.ID>> -
Undocumented
Declaration
Swift
static let operatorIdentifier: Apply<ParserState, SourceRepresentable<Identifier>> -
Undocumented
Declaration
Swift
static let operatorNotation: Apply<ParserState, SourceRepresentable<OperatorNotation>> -
Undocumented
Declaration
Swift
static let precedenceGroup: ContextualKeyword<PrecedenceGroup> -
Undocumented
Declaration
Swift
static let propertyDeclHead: Transform<Combine<TakeKind, TakeKind>, PropertyDeclHead> -
Undocumented
-
Undocumented
Declaration
Swift
static let subscriptDeclHead: Transform<Combine<Combine<Combine<TakeKind, Maybe<TakeKind>>, Maybe<Transform<Combine<Combine<Combine<TakeKind, Transform<Combine<Apply<ParserState, GenericParameterDecl.ID>, ZeroOrMany<Apply<TakeKind.Context, GenericParameterDecl.ID>>>, [GenericParameterDecl.ID]>>, Maybe<Transform<Combine<TakeKind, Transform<Combine<Choose<Apply<ParserState, SourceRepresentable<WhereClause.ConstraintExpr>>, Transform<Combine<Apply<ParserState, Token>, Apply<ParserState, AnyExprID>>, SourceRepresentable<WhereClause.ConstraintExpr>>>, ZeroOrMany<Apply<TakeKind.Context, Choose<Apply<ParserState, SourceRepresentable<WhereClause.ConstraintExpr>>, Transform<Combine<Apply<ParserState, Token>, Apply<ParserState, AnyExprID>>, SourceRepresentable<WhereClause.ConstraintExpr>>>.Element>>>, [SourceRepresentable<WhereClause.ConstraintExpr>]>>, SourceRepresentable<WhereClause>>>>, TakeKind>, SourceRepresentable<GenericClause>>>>, Maybe<Apply<ParserState, [BindingDecl.ID]>>>, SubscriptDeclHead> -
Undocumented
Declaration
Swift
static func parseSubscriptDeclSignature( in state: inout ParserState ) throws -> SubscriptDeclSignature? -
Undocumented
Declaration
Swift
static let subscriptImpl: Combine<Apply<ParserState, SourceRepresentable<AccessEffect>>, Maybe<WrapInContext<TryCatch<Transform<Combine<Combine<TakeKind, Apply<ParserState, AnyExprID>>, TakeKind>, FunctionBody>, Transform<Transform<Combine<Combine<Combine<TakeKind, ZeroOrMany<TakeKind>>, ZeroOrMany<Apply<ParserState, AnyStmtID>>>, TakeKind>, BraceStmt.ID>, FunctionBody>>>>> -
Parses a parameter declaration.
Declaration
Swift
static func parseParameterDecl(in state: inout ParserState) throws -> ParameterDecl.ID? -
Parses the (optional) label and name of a parameter declaration.
Declaration
Swift
static func parseParameterInterface( in state: inout ParserState ) throws -> ParameterInterface? -
Parses the (optional) label and name of a parameter declaration.
Declaration
Swift
private static func parseParameterNameAndLabel( in state: inout ParserState ) throws -> (label: SourceRepresentable<Identifier>?, name: SourceRepresentable<Identifier>)? -
Undocumented
Declaration
Swift
static let memberModifier: Transform<TakeKind, SourceRepresentable<MemberModifier>> -
Undocumented
Declaration
Swift
static let accessModifier: Apply<ParserState, SourceRepresentable<AccessModifier>> -
Undocumented
Declaration
Swift
static let captureList: Apply<ParserState, [BindingDecl.ID]> -
Parses a capture list.
Declaration
Swift
private static func parseCaptureList(in state: inout ParserState) throws -> [BindingDecl.ID]? -
Parses an explicit capture declaration.
Declaration
Swift
private static func parseCaptureDecl(in state: inout ParserState) throws -> BindingDecl.ID? -
The specification of a capture list, for use in
parseList(in:with:).Declaration
Swift
private static let captureListSpecification: DelimitedCommaSeparatedList<Apply<ParserState, BindingDecl.ID>> -
Undocumented
Declaration
Swift
static let genericClause: Transform<Combine<Combine<Combine<TakeKind, Transform<Combine<Apply<ParserState, GenericParameterDecl.ID>, ZeroOrMany<Apply<TakeKind.Context, GenericParameterDecl.ID>>>, [GenericParameterDecl.ID]>>, Maybe<Transform<Combine<TakeKind, Transform<Combine<Choose<Apply<ParserState, SourceRepresentable<WhereClause.ConstraintExpr>>, Transform<Combine<Apply<ParserState, Token>, Apply<ParserState, AnyExprID>>, SourceRepresentable<WhereClause.ConstraintExpr>>>, ZeroOrMany<Apply<TakeKind.Context, Choose<Apply<ParserState, SourceRepresentable<WhereClause.ConstraintExpr>>, Transform<Combine<Apply<ParserState, Token>, Apply<ParserState, AnyExprID>>, SourceRepresentable<WhereClause.ConstraintExpr>>>.Element>>>, [SourceRepresentable<WhereClause.ConstraintExpr>]>>, SourceRepresentable<WhereClause>>>>, TakeKind>, SourceRepresentable<GenericClause>> -
Undocumented
Declaration
Swift
static let genericParameterListContents: Transform<Combine<Apply<ParserState, GenericParameterDecl.ID>, ZeroOrMany<Apply<TakeKind.Context, GenericParameterDecl.ID>>>, [GenericParameterDecl.ID]> -
Undocumented
Declaration
Swift
static let genericParameter: Apply<ParserState, GenericParameterDecl.ID> -
Undocumented
Declaration
Swift
private static func parseGenericParameterDecl( in state: inout ParserState ) throws -> GenericParameterDecl.ID? -
Undocumented
Declaration
Swift
private static func parseGenericParameterIntroducer( in state: inout ParserState ) -> SourceRepresentable<GenericParameterDecl.Introducer>? -
Undocumented
Declaration
-
Parses a binding initializer or a parameter default value.
Declaration
Swift
private static func parseDefaultValue(in state: inout ParserState) throws -> AnyExprID? -
Parses a colon and returns the result of
ascriptionapplied onstate.Declaration
Swift
private static func parseAscription<T>( in state: inout ParserState, _ ascription: (inout ParserState) throws -> T? ) throws -> T?
-
Undocumented
Declaration
Swift
static let expr: Apply<ParserState, AnyExprID> -
Parses an expression in
state.Declaration
Swift
static func parseExpr(in state: inout ParserState) throws -> AnyExprID? -
If the next token is a cast operator, parses an expression and returns a
CastExprappending it tolhs; returnsnilotherwise.Declaration
Swift
private static func appendingCastTail( to lhs: AnyExprID, in state: inout ParserState ) throws -> AnyExprID? -
Parses pairs of infix operators and prefix expressions and, if one or more pairs were parsed, returns a
SequenceExprappending them tolhs; returnsnilotherwise.Declaration
Swift
private static func appendingInfixTail( to lhs: AnyExprID, in state: inout ParserState ) throws -> AnyExprID? -
Undocumented
Declaration
Swift
private static func parsePrefixExpr(in state: inout ParserState) throws -> AnyExprID? -
Undocumented
Declaration
Swift
private static func parsePostfixExpr(in state: inout ParserState) throws -> AnyExprID? -
Undocumented
Declaration
Swift
private static func parseCompoundExpr(in state: inout ParserState) throws -> AnyExprID? -
Undocumented
Declaration
Swift
private static func parseCompoundExprHead(in state: inout ParserState) throws -> AnyExprID? -
If the next token is a dot, parses a tuple or name components, and returns respectively a
TupleMemberExprorNameExprappending it tohead; returnsnilotherwise.Declaration
Swift
private static func appendingNameComponent( to head: AnyExprID, in state: inout ParserState ) throws -> AnyExprID? -
Undocumented
Declaration
Swift
private static func parsePrimaryExpr(in state: inout ParserState) throws -> AnyExprID? -
Parses an integer or float literal expression from
state.Declaration
Swift
private static func parseIntegerOrFloatLiteralExpr( in state: inout ParserState ) throws -> AnyExprID? -
Parses a float literal expression from
state, assuming it has the givenintegerPart.Declaration
Swift
private static func parseFloatLiteralExpr( after integerPart: Token, in state: inout ParserState ) -> FloatLiteralExpr.ID? -
Undocumented
Declaration
Swift
private static func parseExistentialTypeExpr( in state: inout ParserState ) throws -> ExistentialTypeExpr.ID? -
Undocumented
Declaration
Swift
private static func parsePrimaryDeclRefExpr( in state: inout ParserState ) throws -> NameExpr.ID? -
Parses a pragma literal from
state.Declaration
Swift
private static func parsePragmaLiteralExpr( in state: inout ParserState ) throws -> PragmaLiteralExpr.ID? -
Undocumented
Declaration
Swift
private static func parseImplicitMemberDeclRefExpr( in state: inout ParserState ) throws -> NameExpr.ID? -
Undocumented
Declaration
Swift
private static func parseNameExprComponent( in state: inout ParserState ) throws -> NameExprComponent? -
Undocumented
Declaration
Swift
private static func parseArgument(in state: inout ParserState) throws -> LabeledArgument? -
Undocumented
Declaration
Swift
private static func parseEntityName( in state: inout ParserState ) throws -> SourceRepresentable<Name>? -
Undocumented
Declaration
Swift
private static func parseFunctionEntityName( in state: inout ParserState ) throws -> SourceRepresentable<Name>? -
Undocumented
Declaration
Swift
private static func parseOperatorEntityName( in state: inout ParserState ) throws -> SourceRepresentable<Name>? -
Undocumented
Declaration
Swift
private static func parseLambdaExpr(in state: inout ParserState) throws -> LambdaExpr.ID? -
Undocumented
Declaration
Swift
private static let lambdaBody: WrapInContext<TryCatch<Transform<Combine<Combine<TakeKind, Apply<ParserState, AnyExprID>>, TakeKind>, FunctionBody>, Transform<Transform<Combine<Combine<Combine<TakeKind, ZeroOrMany<TakeKind>>, ZeroOrMany<Apply<ParserState, AnyStmtID>>>, TakeKind>, BraceStmt.ID>, FunctionBody>>> -
Parses a conditional expression.
Declaration
Swift
private static func parseConditionalExpr( in state: inout ParserState ) throws -> ConditionalExpr.ID? -
Parses a single expression enclosed in curly braces.
Declaration
Swift
private static func parseBracedExpr( in state: inout ParserState ) throws -> AnyExprID? -
Undocumented
Declaration
Swift
private static func parseMatchExpr(in state: inout ParserState) throws -> MatchExpr.ID? -
Undocumented
Declaration
Swift
private static func parseMatchBody(in state: inout ParserState) throws -> [MatchCase.ID]? -
Undocumented
Declaration
Swift
private static func parseMatchCase(in state: inout ParserState) throws -> MatchCase.ID? -
Undocumented
Declaration
Swift
private static func parseMatchCaseBody(in state: inout ParserState) throws -> MatchCase.Body? -
Undocumented
Declaration
Swift
private static func parseRemoteExpr( in state: inout ParserState ) throws -> RemoteTypeExpr.ID? -
Undocumented
Declaration
Swift
private static func parseSpawnExpr(in state: inout ParserState) throws -> SpawnExpr.ID? -
Undocumented
Declaration
Swift
private static func parseArrowTypeOrTupleExpr( in state: inout ParserState ) throws -> AnyExprID? -
Undocumented
Declaration
Swift
private static func parseArrowTypeOrBracketedExpr( in state: inout ParserState ) throws -> AnyExprID? -
Undocumented
Declaration
Swift
private static func parseTupleOrParenthesizedExpr( in state: inout ParserState ) throws -> AnyExprID? -
Undocumented
Declaration
Swift
private static func parseTupleExprElement( in state: inout ParserState ) throws -> TupleExpr.Element? -
Undocumented
Declaration
Swift
private static func parseTupleTypeExpr( in state: inout ParserState ) throws -> TupleTypeExpr.ID? -
Undocumented
Declaration
Swift
private static func parseTupleTypeExprElement( in state: inout ParserState ) throws -> TupleTypeExpr.Element? -
Undocumented
Declaration
Swift
private static func parseCompoundLiteral(in state: inout ParserState) throws -> AnyExprID? -
Undocumented
Declaration
Swift
private static let callArgument: Apply<ParserState, LabeledArgument> -
Undocumented
Declaration
Swift
static let conditionalClause: Transform<Combine<Apply<ParserState, ConditionItem>, ZeroOrMany<Apply<TakeKind.Context, ConditionItem>>>, [ConditionItem]> -
Undocumented
Declaration
Swift
static let conditionalClauseItem: Apply<ParserState, ConditionItem> -
Parses a part of a conditional clause.
Declaration
Swift
private static func parseConditionalClauseItem( in state: inout ParserState ) throws -> ConditionItem? -
Parses a binding declaration used as part of a conditional clause.
Declaration
Swift
private static func parseConditionalClauseBinding( in state: inout ParserState ) throws -> ConditionItem?
-
Undocumented
Declaration
Swift
private static let staticArgumentList: DelimitedCommaSeparatedList<Apply<ParserState, LabeledArgument>> -
Undocumented
Declaration
Swift
private static func parseStaticArgumentList( in state: inout ParserState ) throws -> [LabeledArgument]? -
Undocumented
Declaration
Swift
private static let functionCallArgumentList: DelimitedCommaSeparatedList<Apply<ParserState, LabeledArgument>> -
Undocumented
Declaration
Swift
private static func parseFunctionCallArgumentList( in state: inout ParserState ) throws -> [LabeledArgument]? -
Undocumented
Declaration
Swift
private static let subscriptCallArgumentList: DelimitedCommaSeparatedList<Apply<ParserState, LabeledArgument>> -
Undocumented
Declaration
Swift
private static func parseSubscriptCallArgumentList( in state: inout ParserState ) throws -> [LabeledArgument]? -
Undocumented
Declaration
Swift
private static let attributeArgumentList: DelimitedCommaSeparatedList<Apply<ParserState, Attribute.Argument>> -
Undocumented
Declaration
Swift
private static func parseAttributeArgumentList( in state: inout ParserState ) throws -> [Attribute.Argument]? -
Undocumented
Declaration
Swift
private static let parameterList: DelimitedCommaSeparatedList<Apply<ParserState, ParameterDecl.ID>> -
Undocumented
Declaration
Swift
private static func parseParameterList( in state: inout ParserState ) throws -> [ParameterDecl.ID]? -
Undocumented
Declaration
Swift
private static let arrowParameterList: DelimitedCommaSeparatedList<Apply<ParserState, ArrowTypeExpr.Parameter>> -
Undocumented
Declaration
Swift
private static func parseArrowParameterList( in state: inout ParserState ) throws -> [ArrowTypeExpr.Parameter]? -
Undocumented
Declaration
Swift
private static func parseList<C: Combinator>( in state: inout ParserState, with parser: DelimitedCommaSeparatedList<C> ) throws -> [C.Element]? where C.Context == ParserState -
Undocumented
Declaration
Swift
private static let tupleExprElementList: DelimitedCommaSeparatedList<Apply<ParserState, TupleExpr.Element>> -
Undocumented
Declaration
Swift
private static let tupleTypeExprElementList: DelimitedCommaSeparatedList<Apply<ParserState, TupleTypeExpr.Element>> -
Undocumented
Declaration
Swift
private static let bufferLiteral: DelimitedCommaSeparatedList<Apply<ParserState, AnyExprID>> -
Undocumented
Declaration
Swift
private static let nonemptyMapLiteral: DelimitedCommaSeparatedList<Apply<ParserState, MapLiteralExpr.Element>> -
Undocumented
Declaration
Swift
private static func parseMapElement(in state: inout ParserState) throws -> MapLiteralExpr.Element? -
Undocumented
Declaration
Swift
private static func parseMapLiteral(in state: inout ParserState) throws -> MapLiteralExpr?
-
Undocumented
Declaration
Swift
private static func anyPattern<Base: Combinator>( _ base: Base ) -> AnyCombinator<ParserState, AnyPatternID> where Base.Context == ParserState, Base.Element: PatternID -
Undocumented
Declaration
Swift
private static func parsePattern(in state: inout ParserState) throws -> AnyPatternID? -
Undocumented
Declaration
Swift
private static let bindingPattern: Apply<ParserState, BindingPattern.ID> -
Undocumented
Declaration
Swift
static func parseBindingPattern( in state: inout ParserState ) throws -> BindingPattern.ID? -
Parses a binding introducer.
Should not be called before checking if the next token is
_if another wildcard rule could apply.Declaration
Swift
private static func parseBindingIntroducer( in state: inout ParserState ) throws -> SourceRepresentable<BindingPattern.Introducer>? -
Undocumented
Declaration
Swift
static let exprPattern: Apply<ParserState, AnyPatternID> -
Undocumented
Declaration
Swift
static let namePattern: Transform<TakeKind, NamePattern.ID> -
Undocumented
Declaration
Swift
static let tuplePattern: Transform<Combine<Combine<TakeKind, Maybe<Transform<Combine<Apply<ParserState, TuplePattern.Element>, ZeroOrMany<Apply<TakeKind.Context, TuplePattern.Element>>>, [TuplePattern.Element]>>>, TakeKind>, TuplePattern.ID> -
Undocumented
Declaration
Swift
static let tuplePatternElementList: Transform<Combine<Apply<ParserState, TuplePattern.Element>, ZeroOrMany<Apply<TakeKind.Context, TuplePattern.Element>>>, [TuplePattern.Element]> -
Undocumented
Declaration
Swift
static let tuplePatternElement: Apply<ParserState, TuplePattern.Element> -
Undocumented
Declaration
Swift
static let wildcardPattern: Transform<TakeKind, WildcardPattern.ID>
-
Undocumented
Declaration
Swift
private static func anyStmt<Base: Combinator>( _ base: Base ) -> AnyCombinator<ParserState, AnyStmtID> where Base.Context == ParserState, Base.Element: StmtID -
Undocumented
Declaration
Swift
static let stmt: Recursive<ParserState, AnyStmtID> -
Undocumented
Declaration
Swift
static let _stmt: ChooseN<AnyCombinator<ParserState, AnyStmtID>> -
Undocumented
Declaration
-
Undocumented
Declaration
Swift
static let discardStmt: Transform<Combine<Combine<TakeKind, TakeKind>, Apply<ParserState, AnyExprID>>, DiscardStmt.ID> -
Undocumented
Declaration
Swift
private static func parseElseClause( in state: inout ParserState ) throws -> Introduced<AnyStmtID>? -
Parses a conditional statement.
Declaration
Swift
private static func parseConditionalStmt( in state: inout ParserState ) throws -> ConditionalStmt.ID? -
Undocumented
Declaration
Swift
static let doWhileStmt: Transform<Combine<Combine<Combine<TakeKind, WrapInContext<Transform<Combine<Combine<Combine<TakeKind, ZeroOrMany<TakeKind>>, ZeroOrMany<Apply<ParserState, AnyStmtID>>>, TakeKind>, BraceStmt.ID>>>, TakeKind>, Apply<ParserState, AnyExprID>>, DoWhileStmt.ID> -
Undocumented
Declaration
Swift
static let whileStmt: Transform<Combine<Combine<TakeKind, Transform<Combine<Apply<ParserState, ConditionItem>, ZeroOrMany<Apply<TakeKind.Context, ConditionItem>>>, [ConditionItem]>>, WrapInContext<Transform<Combine<Combine<Combine<TakeKind, ZeroOrMany<TakeKind>>, ZeroOrMany<Apply<ParserState, AnyStmtID>>>, TakeKind>, BraceStmt.ID>>>, WhileStmt.ID> -
Undocumented
Declaration
Swift
static let forStmt: Apply<ParserState, ForStmt.ID> -
Parses a for-loop.
Declaration
Swift
private static func parseForLoop(in state: inout ParserState) throws -> ForStmt.ID? -
Parses the binding of a for-loop.
Declaration
Swift
private static func parseForLoopBinding(in state: inout ParserState) throws -> BindingDecl.ID? -
Parses the filter of a for-loop.
Declaration
Swift
private static func parseForLoopFilter( in state: inout ParserState ) throws -> Introduced<AnyExprID>? -
Undocumented
Declaration
Swift
static let loopBody: WrapInContext<Transform<Combine<Combine<Combine<TakeKind, ZeroOrMany<TakeKind>>, ZeroOrMany<Apply<ParserState, AnyStmtID>>>, TakeKind>, BraceStmt.ID>> -
Undocumented
Declaration
Swift
static let returnStmt: Transform<Combine<TakeKind, Maybe<Apply<ParserState, AnyExprID>>>, ReturnStmt.ID> -
Undocumented
Declaration
Swift
static let yieldStmt: Transform<Combine<TakeKind, Apply<ParserState, AnyExprID>>, YieldStmt.ID> -
Undocumented
-
Undocumented
Declaration
Swift
static let continueStmt: Transform<TakeKind, ContinueStmt.ID> -
Undocumented
Declaration
Swift
static let bindingStmt: Apply<ParserState, AnyStmtID> -
Parses a binding statement.
Declaration
Swift
private static func parseBindingStmt(in state: inout ParserState) throws -> AnyStmtID? -
Undocumented
Declaration
Swift
static let declStmt: Transform<Apply<ParserState, AnyDeclID>, DeclStmt.ID> -
Undocumented
Declaration
Swift
static let exprStmt: Apply<ParserState, AnyStmtID> -
Undocumented
Declaration
Swift
private static func parseExprOrAssignStmt(in state: inout ParserState) throws -> AnyStmtID? -
Undocumented
Declaration
Swift
static let compilerConditionStmt: Apply<ParserState, AnyStmtID> -
Undocumented
Declaration
Swift
private static func parseCompilerConditionStmt( in state: inout ParserState ) throws -> AnyStmtID? -
Parses a logical connective from
state.Declaration
Swift
private static func parseConnective(in state: inout ParserState) -> Connective? -
Parses a
See moreConditionfor aConditionalCompilationStmt.Declaration
Swift
private static func parseCondition( in state: inout ParserState ) throws -> ConditionalCompilationStmt.Condition -
Parses a compiler condition structure, after the initial token (#if or #elseif).
Declaration
Swift
private static func parseCompilerConditionTail( head: Token, in state: inout ParserState ) throws -> AnyStmtID -
Skips the branch body of a conditional compilation statement and nested conditional compilation statements.
Declaration
Swift
private static func skipConditionalCompilationBranch( in state: inout ParserState, stoppingAtElse: Bool ) throws -
Parses the body of a compiler condition structure branch.
Declaration
Swift
private static func parseConditionalCompilationBranch( in state: inout ParserState ) throws -> [AnyStmtID] -
Parses the condition of a compiler conditional.
Declaration
Swift
private static func parseCompilerCondition( in state: inout ParserState ) throws -> ConditionalCompilationStmt.Condition
-
Undocumented
Declaration
Swift
private static let nameTypeExpr: Apply<ParserState, NameExpr.ID> -
Undocumented
Declaration
Swift
private static func parseNameTypeExpr(in state: inout ParserState) throws -> NameExpr.ID? -
Undocumented
Declaration
Swift
private static func parseArrowParameter( in state: inout ParserState ) throws -> ArrowTypeExpr.Parameter? -
Parses the type annotation of a parameter declaration.
Declaration
Swift
static func parseParameterTypeExpr( in state: inout ParserState ) throws -> NodeID<ParameterTypeExpr>? -
Undocumented
Declaration
Swift
static let receiverEffect: Apply<ParserState, SourceRepresentable<AccessEffect>> -
Undocumented
Declaration
Swift
static let passingConvention: Apply<ParserState, SourceRepresentable<AccessEffect>> -
Undocumented
Declaration
Swift
static let accessEffect: Apply<ParserState, SourceRepresentable<AccessEffect>> -
Undocumented
Declaration
Swift
static let whereClause: Transform<Combine<TakeKind, Transform<Combine<Choose<Apply<ParserState, SourceRepresentable<WhereClause.ConstraintExpr>>, Transform<Combine<Apply<ParserState, Token>, Apply<ParserState, AnyExprID>>, SourceRepresentable<WhereClause.ConstraintExpr>>>, ZeroOrMany<Apply<TakeKind.Context, Choose<Apply<ParserState, SourceRepresentable<WhereClause.ConstraintExpr>>, Transform<Combine<Apply<ParserState, Token>, Apply<ParserState, AnyExprID>>, SourceRepresentable<WhereClause.ConstraintExpr>>>.Element>>>, [SourceRepresentable<WhereClause.ConstraintExpr>]>>, SourceRepresentable<WhereClause>> -
Undocumented
Declaration
Swift
static let whereClauseConstraintList: Transform<Combine<Choose<Apply<ParserState, SourceRepresentable<WhereClause.ConstraintExpr>>, Transform<Combine<Apply<ParserState, Token>, Apply<ParserState, AnyExprID>>, SourceRepresentable<WhereClause.ConstraintExpr>>>, ZeroOrMany<Apply<TakeKind.Context, Choose<Apply<ParserState, SourceRepresentable<WhereClause.ConstraintExpr>>, Transform<Combine<Apply<ParserState, Token>, Apply<ParserState, AnyExprID>>, SourceRepresentable<WhereClause.ConstraintExpr>>>.Element>>>, [SourceRepresentable<WhereClause.ConstraintExpr>]> -
Undocumented
Declaration
Swift
static let whereClauseConstraint: Choose<Apply<ParserState, SourceRepresentable<WhereClause.ConstraintExpr>>, Transform<Combine<Apply<ParserState, Token>, Apply<ParserState, AnyExprID>>, SourceRepresentable<WhereClause.ConstraintExpr>>> -
Undocumented
Declaration
Swift
static let typeConstraint: Apply<ParserState, SourceRepresentable<WhereClause.ConstraintExpr>> -
Undocumented
Declaration
Swift
static let valueConstraint: Transform<Combine<Apply<ParserState, Token>, Apply<ParserState, AnyExprID>>, SourceRepresentable<WhereClause.ConstraintExpr>> -
Undocumented
Declaration
Swift
static let boundComposition: Transform<Combine<Apply<ParserState, NameExpr.ID>, ZeroOrMany<Apply<TakeKind.Context, NameExpr.ID>>>, [NameExpr.ID]>
-
Parses a list of attributes.
Declaration
Swift
static func parseAttributeList( in state: inout ParserState ) throws -> [SourceRepresentable<Attribute>]? -
Parses a single attribute.
Declaration
Swift
static func parseAttribute( in state: inout ParserState ) throws -> SourceRepresentable<Attribute>? -
Undocumented
Declaration
Swift
private static func parseAttributeArgument( in state: inout ParserState ) throws -> Attribute.Argument? -
Undocumented
Declaration
Swift
static let valueAttribute: Apply<ParserState, Token>
View on GitHub