parse

open fun parse(inputStream: InputStream, charset: Charset = Charsets.UTF_8, considerRange: Boolean = true, measureLexingTime: Boolean = false, source: Source? = null): ParsingResult<R>

Parses source code, returning a result that includes an AST and a collection of parse issues (errors, warnings). The parsing is done in accordance to the StarLasu methodology i.e. a first-stage parser builds a parse tree which is then mapped onto a higher-level tree called the AST.

Parameters

inputStream

the source code.

charset

the character set in which the input is encoded.

considerPosition

if true (the default), parsed AST nodes record their position in the input text.

measureLexingTime

if true, the result will include a measurement of the time spent in lexing i.e. breaking the input stream into tokens.


abstract fun parse(code: String, considerRange: Boolean = true, measureLexingTime: Boolean = false, source: Source? = null): ParsingResult<R>
open fun parse(code: String, considerRange: Boolean = true, measureLexingTime: Boolean = false): ParsingResult<R>
abstract fun parse(file: File, charset: Charset = Charsets.UTF_8, considerRange: Boolean = true, measureLexingTime: Boolean = false): ParsingResult<R>