class Pegmatite::DSL

Overview

The Pegmatite::DSL allows you to tersely define a deeply composed Pattern by providing convenience methods for creating new Pattern instances.

See spec/fixtures/json.cr for a detailed real-world example of using the DSL.

Defined in:

pegmatite/dsl.cr

Class Method Summary

Instance Method Summary

Class Method Detail

def self.clear_class_variables_state #

[View source]
def self.define(&) #

[View source]
def self.last_defined_whitespace_pattern #

[View source]

Instance Method Detail

def any #

[View source]
def char(c) #

[View source]
def declare #

[View source]
def dynamic_match(label) #

[View source]
def l(lit) #

[View source]
def range(min, max) #

[View source]
def str(text) #

[View source]
def whitespace_pattern(pattern : Pattern) #

Define a DSL method for setting the pattern to use for whitespace in the ^ operator, which allows optional whitespace between concatenated patterns. Using class variables here is not ideal, but it's acceptable for a DSL.


[View source]