class

Pegmatite::DSL

Inherits Reference < Object

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.

Class methods

clear_class_variables_state
Source
define
Source
last_defined_whitespace_pattern
Source

Instance methods

char(c)
Source
declare
Source
dynamic_match(label)
Source
l(lit)
Source
range(min, max)
Source
str(text)
Source
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.

Source

Nested types