View Source Grammar.Clause (Grammar v0.3.0)

A Clause entity represents a grammar clause, by its substitution and callback to execute.

The substitution is a list of steps, which can be either a rule name or a token prototype.

The parameter function is the callback to execute when the clause is fully matched. It is given a list as parameter, each element of that list is the value produced by the substitution of each term.

Summary

Functions

Create a new clause with a given substitution and callback function.

Types

@type callback() :: ([term()] -> term())
@type substitution() :: [term()]
@type t() :: %Grammar.Clause{function: callback(), substitution: substitution()}

Functions

Link to this function

new(substitution, function)

View Source
@spec new(substitution(), callback()) :: t()

Create a new clause with a given substitution and callback function.