GuestLanguageParser

A GuestLanguage feature for parsing Source code in a given PolyglotContext, returning an executable PolyglotValue.

Install an implementation of this interface using a PolyglotContextElement with a key obtained from GuestLanguageParser.contextElementFor, with the target language as identifier, to intercept calls to PolyglotContext.parse.

PolyglotContext implementations will always prefer delegating parsing logic to a GuestLanguageParser for the relevant source if one is registered, falling back to their defaults if none is found.

See also

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open fun accepts(source: Source): Boolean

Analyzes the given source and returns whether it can be used with this parser.

Link copied to clipboard
abstract fun parse(source: Source, context: PolyglotContext): PolyglotValue

Parse a source in the given context without evaluating it, returning an executable PolyglotValue.