Package com.io7m.cedarbridge.exprsrc.internal

# Class CBExpressionSource

java.lang.Object
com.io7m.cedarbridge.exprsrc.internal.CBExpressionSource

All Implemented Interfaces:
  `CBExpressionLineLogType`, `CBExpressionSourceType`, `Closeable`, `AutoCloseable`

public final class CBExpressionSource extends Object implements CBExpressionSourceType
The default expression source.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CBExpressionSource(CBRecordingUnicodeCharacterReader inReader, URI inUri, InputStream inStream, com.io7m.jsx.api.parser.JSXParserType inParser)`
  The default expression source.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  `Optional<String>`
  `contextualize(com.io7m.jlexing.core.LexicalPosition<?> position)`
  Show a contextually highlighted line for the given lexical position.
  `Optional<com.io7m.jsx.SExpressionType>`
  `parseExpressionOrEOF()`
  `Optional<String>`
  `showLineFor(int lineNumber)`
  Show the previously-encountered line with the given line number.
  `URI`
  `source()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### CBExpressionSource

    public CBExpressionSource(CBRecordingUnicodeCharacterReader inReader, URI inUri, InputStream inStream, com.io7m.jsx.api.parser.JSXParserType inParser)
    The default expression source.
    Parameters:
      `inReader` - A character reader
      `inUri` - The source URI
      `inStream` - The source stream
      `inParser` - The source parser

- ## Method Details

  - ### source

    public URI source()
    Specified by:
      `source` in interface `CBExpressionSourceType`
    Returns:
      The URI of the source

  - ### parseExpressionOrEOF

    public Optional<com.io7m.jsx.SExpressionType> parseExpressionOrEOF() throws com.io7m.jsx.api.parser.JSXParserException, IOException
    Specified by:
      `parseExpressionOrEOF` in interface `CBExpressionSourceType`
    Returns:
      The next expression, or `Optional.empty()` if EOF is reached
    Throws:
      `com.io7m.jsx.api.parser.JSXParserException` - On parse errors
      `IOException` - On I/O errors

  - ### showLineFor

    public Optional<String> showLineFor(int lineNumber)
    Description copied from interface: `CBExpressionLineLogType`
    Show the previously-encountered line with the given line number.
    Specified by:
      `showLineFor` in interface `CBExpressionLineLogType`
    Parameters:
      `lineNumber` - The line number
    Returns:
      The line, if one has been encountered

  - ### contextualize

    public Optional<String> contextualize(com.io7m.jlexing.core.LexicalPosition<?> position)
    Description copied from interface: `CBExpressionLineLogType`
    Show a contextually highlighted line for the given lexical position.
    Specified by:
      `contextualize` in interface `CBExpressionLineLogType`
    Parameters:
      `position` - The position
    Returns:
      The highlighted line, if one has been encountered

  - ### close

    public void close() throws IOException
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in interface `Closeable`
    Throws:
      `IOException`