SourceParser

data class SourceParser<T, K : Token<T>, E, R>(lexer: Lexer<K>, parser: Parser<T, K, E, R>)

Reads characters from a Source with a lexer, parsing the resulting tokens with a pratt-parser.

Author

AdrianTodt

Parameters

T

The parser's (and grammar's) token type.

E

The parser's (and grammar's) expression result.

R

The parser's result.

lexer

The underlying lexer.

parser

The underlying parser.

Constructors

SourceParser
Link copied to clipboard
common
fun <T, K : Token<T>, E, R> SourceParser(lexer: Lexer<K>, parser: Parser<T, K, E, R>)

Types

Companion
Link copied to clipboard
common
object Companion

Functions

parse
Link copied to clipboard
common
fun parse(source: Source): R

Parses tokens from a source, using the bundled lexer, with this pratt-parser, and returns the computed result.

Properties

lexer
Link copied to clipboard
common
val lexer: Lexer<K>
parser
Link copied to clipboard
common
val parser: Parser<T, K, E, R>