class Pegasus::Language::Rule

Overview

A single rule. This can have one or more alternatives, but has the same options (zero or more) applied to them.

Defined in:

pegasus/language_def.cr

Constructors

Instance Method Summary

Instance methods inherited from class Pegasus::Language::OptionObject

options : Array(Option) options

Constructor methods inherited from class Pegasus::Language::OptionObject

new new

Constructor Detail

def self.new(alternatives : Array(Pegasus::Language::RuleAlternative), options = [] of Option) #

[View source]

Instance Method Detail

def ==(other : Rule) #

[View source]
def alternatives : Array(RuleAlternative) #

[View source]
def compute_optional_variants #

Creates a new rule with the same options, but with alternatives expanded for optional values.


[View source]
def compute_optional_variants(&block) #

Creates a new rule with the same options, but with alternatives expanded for optional values. Uses a custom block to check if the elements can be empty or not.


[View source]
def derives_lambda? #

Checks if this rule has any alternatives that can derive lambda.


[View source]
def derives_lambda?(&) #

Checks if this rule has any alternatives that can derive lambda, using a custom block for checking if an element can derive lambda.


[View source]
def hash(hasher) #
Description copied from class Reference

See Object#hash(hasher)


[View source]