Structures

The following structures are available globally.

  • HomogenousTree is used as the default form of AbstractSyntaxTree. Each node in the tree captures its TokenType, the String it mtached, and any children.

    See more

    Declaration

    Swift

    public struct HomogenousTree : AbstractSyntaxTree, CustomStringConvertible
  • A standard decoder that can use any supplied Parser to decode Data into a Decodable conforming type.

       do{
           let command : Command = try ParsingDecoder().decode(Command.self, from: userInput.data(using: .utf8) ?? Data(), with: Bork.generatedLanguage)
    
           ...
       } catch {
           print("Something went wrong: \(error.localizedDescription)")
       }
    

    The names of the Tokens generated by the supplied Parser are used as keys into the Decodable type being populated.

    See more

    Declaration

    Swift

    public struct ParsingDecoder
  • Represents the type of processing error.

    See more

    Declaration

    Swift

    public struct ProcessingErrorType : OptionSet
  • Behaviour represents a complete description of the required behaviour of any given rule. This includes behaviours such as lookahead, negation, and cardinality. As well the scanning/parsing behaviour indicating whether or not the rule should create tokens (structural), is scanning (should be included in the match range, but creates no token) or skipping (must be matched, but is not included in the bounds of the match range).

    See more

    Declaration

    Swift

    public struct Behaviour
  • Represents the cardinality of a rule. It can be specified as a closed range, including those with no upper bound (PartialRangeFrom)

    See more

    Declaration

    Swift

    public struct Cardinality : Equatable
  • A generic TokenType implementation that is labelled (has an associated `String). The value is automatically generated

    See more

    Declaration

    Swift

    public struct StringToken : TokenType, CustomStringConvertible