Arborist::Grammar::GrammarParserBuilder
Inherits Arborist::DSL / Reference / Object
Instance methods
def add_to_mutex_alt_set(strings_or_dot : Set(String) | Dot, new_string : String) : Set(String) | Dot
if !strings.empty?
existing_string = strings.first
raise MutexAltBuildFailure.new("Alternatives not all same string length.") unless existing_string.size == new_string.size
end
if strings_or_dot.is_a?(Set(String)) strings_or_dot << new_string end strings_or_dot end
takes a parse tree for an Arborist grammar definition and returns a Matcher that can build parse trees for that grammar definition
returns a MutexAlt if the rule can be represented as a MutexAlt, or a Dot if the rule represents any character; nil otherwise
rule_name is the name of the rule that, as a result of being evaluated, yielded the parse_tree node.
In other words, rule_name was the name of the rule that was actively being matched and produced a parse tree that
included the parse tree node represented by parse_tree.
parse_tree is the first (and only) child of an ApplyTree node.
Returns a MutexAlt if the parse tree can be represented as a MutexAlt; nil otherwise
parse_tree is the first (and only) child of an ApplyTree node - it is the root tree node of a rule definition
returns a Matcher that knows how to parse the grammar represented by parse_tree parse_tree is a ParseTree produced by Arborist::Grammar::Rules::GrammarParser
takes a grammar parse tree and returns a Hash(String, ParseTree) representing the rules as a map of rule-name -> rule-body-parse-tree pairs