In package com.copperleaf.kudzu.parser

class com.copperleaf.kudzu.parser.ChoiceParser

Given a set of parsers, choose a single one to parse. The first parser that predicts true is chosen. If a parser predicts true, it is expected to parse successfully as well.

Predicts true when:

  • at least one parser predicts true

Parsing fails when:

  • none of the provides parsers are able to parse successfully

Constructors

constructor(parsers: Parser, name: String = "")

Given a set of parsers, choose a single one to parse. The first parser that predicts true is chosen. If a parser predicts true, it is expected to parse successfully as well.

Predicts true when:

  • at least one parser predicts true

Parsing fails when:

  • none of the provides parsers are able to parse successfully

Parameters:
  • parsers: Parser
  • name: String = ""

Methods

fun predict(input: ParserContext): Boolean

Parameters:
fun parse(input: ParserContext): <Node, ParserContext>

Parameters:

Extensions

fun checkNotEmpty(input: ParserContext)

Parameters: