Package com.io7m.cedarbridge.schema.parser.internal

# Interface CBParseContextType

All Superinterfaces:
  `AutoCloseable`

public interface CBParseContextType extends AutoCloseable
The parsing context.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `<T extends com.io7m.jsx.SExpressionType>
  T`
  `checkExpressionIs(com.io7m.jsx.SExpressionType expression, Optional<UUID> specSection, Class<T> clazz)`
  Check that the expression is of the given type.
  `com.io7m.jsx.SExpressionType.SSymbol`
  `checkExpressionIsKeyword(com.io7m.jsx.SExpressionType expression, Optional<UUID> specSection, String name, String errorCode)`
  Check that the expression is a keyword.
  `void`
  `close()`
  `int`
  `errorCount()`
  `CBParseFailedException`
  `failed(com.io7m.jlexing.core.LexicalPosition<URI> lexical, CBParseFailedException.Fatal fatality, Optional<UUID> specSection, Exception exception, String errorCode)`
  Parsing failed.
  `CBParseFailedException`
  `failed(com.io7m.jlexing.core.LexicalPosition<URI> lexical, CBParseFailedException.Fatal fatality, Optional<UUID> specSection, String errorCode)`
  Parsing failed.
  `CBParseFailedException`
  `failed(com.io7m.jsx.SExpressionType expression, CBParseFailedException.Fatal fatality, Optional<UUID> specSection, String errorCode)`
  Parsing failed.
  `CBParseFailedException`
  `failed(com.io7m.jsx.SExpressionType expression, CBParseFailedException.Fatal fatality, Optional<UUID> specSection, String errorCode, Exception e)`
  Parsing failed.
  `CBParseContextType`
  `openExpectingOneOf(String kind, List<String> shapes)`
  Open a new parsing context expecting one of the given shapes.
  `void`
  `setLanguageVersion(int major, int minor)`
  Set the expected language version.

- ## Method Details

  - ### openExpectingOneOf

    CBParseContextType openExpectingOneOf(String kind, List<String> shapes)
    Open a new parsing context expecting one of the given shapes.
    Parameters:
      `kind` - The kind
      `shapes` - The shapes
    Returns:
      A new parsing context

  - ### close

    void close() throws CBParseFailedException
    Specified by:
      `close` in interface `AutoCloseable`
    Throws:
      `CBParseFailedException`

  - ### setLanguageVersion

    void setLanguageVersion(int major, int minor)
    Set the expected language version.
    Parameters:
      `major` - The major version
      `minor` - The minor version

  - ### checkExpressionIs

    <T extends com.io7m.jsx.SExpressionType> T checkExpressionIs(com.io7m.jsx.SExpressionType expression, Optional<UUID> specSection, Class<T> clazz) throws CBParseFailedException
    Check that the expression is of the given type.
    Type Parameters:
      `T` - The expression type
    Parameters:
      `expression` - The expression
      `specSection` - The quoted spec section
      `clazz` - The class
    Returns:
      expression
    Throws:
      `CBParseFailedException` - On errors

  - ### checkExpressionIsKeyword

    com.io7m.jsx.SExpressionType.SSymbol checkExpressionIsKeyword(com.io7m.jsx.SExpressionType expression, Optional<UUID> specSection, String name, String errorCode) throws CBParseFailedException
    Check that the expression is a keyword.
    Parameters:
      `expression` - The expression
      `specSection` - The quoted spec section
      `name` - The keyword
      `errorCode` - The error code
    Returns:
      expression
    Throws:
      `CBParseFailedException` - On errors

  - ### failed

    CBParseFailedException failed(com.io7m.jsx.SExpressionType expression, CBParseFailedException.Fatal fatality, Optional<UUID> specSection, String errorCode, Exception e)
    Parsing failed.
    Parameters:
      `fatality` - The fatality level
      `specSection` - The quoted spec section
      `errorCode` - The error code
      `e` - The exception
      `expression` - The expression
    Returns:
      A parse exception

  - ### failed

    CBParseFailedException failed(com.io7m.jsx.SExpressionType expression, CBParseFailedException.Fatal fatality, Optional<UUID> specSection, String errorCode)
    Parsing failed.
    Parameters:
      `fatality` - The fatality level
      `specSection` - The quoted spec section
      `errorCode` - The error code
      `expression` - The expression
    Returns:
      A parse exception

  - ### errorCount

    int errorCount()
    Returns:
      The number of errors encountered so far

  - ### failed

    CBParseFailedException failed(com.io7m.jlexing.core.LexicalPosition<URI> lexical, CBParseFailedException.Fatal fatality, Optional<UUID> specSection, Exception exception, String errorCode)
    Parsing failed.
    Parameters:
      `lexical` - The lexical position
      `fatality` - The fatality level
      `specSection` - The quoted spec section
      `exception` - The exception
      `errorCode` - The error code
    Returns:
      A parse exception

  - ### failed

    CBParseFailedException failed(com.io7m.jlexing.core.LexicalPosition<URI> lexical, CBParseFailedException.Fatal fatality, Optional<UUID> specSection, String errorCode)
    Parsing failed.
    Parameters:
      `lexical` - The lexical position
      `fatality` - The fatality level
      `specSection` - The quoted spec section
      `errorCode` - The error code
    Returns:
      A parse exception