FunctionCallGrammar

class FunctionCallGrammar(allowsBody: Boolean) : Grammar<WalkedFunctionCall>

Grammar that defines and parses a function call. The output object is WalkedFunctionCall, which will later be converted to a FunctionCall by BlockTokenParser.

The following is an example of a function call:

.func {arg1} {arg2} name:{arg3}
body argument line 1
body argument line 2

On its own, the function call grammar is context-aware, as the argument are not subject to syntactic rules, as they may represent Markdown content (argument type checking is performed in the function expansion stage of the pipeline instead, see com.quarkdown.core.function.call.binding). In order to achieve context-awareness, this grammar is stateful and mutable, as it needs to know whether it is currently parsing the outer 'rigid' syntax or an argument.

Parameters

allowsBody

whether the function call allows an indented body argument. Generally, this is true for block functions, false for inline functions.

Constructors

Link copied to clipboard
constructor(allowsBody: Boolean)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open val declaredParsers: Set<Parser<*>>
Link copied to clipboard
open override val rootParser: Parser<WalkedFunctionCall>

Entry point of the grammar. Parses the whole chain of function calls. The result is an ordered linked list of WalkedFunctionCalls, and the first of them is returned.

Link copied to clipboard
open val tokenizer: Tokenizer
Link copied to clipboard
open val tokens: List<Token>

Functions

Link copied to clipboard
override fun tryParse(tokens: TokenMatchesSequence, fromPosition: Int): ParseResult<WalkedFunctionCall>