Class: Aura::Parser

Inherits:
Parslet::Parser
  • Object
show all
Defined in:
lib/aura/parser.rb,
lib/aura.rb

Overview

PEG grammar for the Aura DSL, built on Parslet. The grammar is whitespace- and blank-line tolerant; full-line ‘#` comments are stripped (and replaced by blank lines, preserving line numbers) before parsing – see Aura.preprocess in lib/aura.rb.

Instance Method Summary collapse

Instance Method Details

#block_body(line_atom, key) ⇒ Object

—- helpers ————————————————————- A ‘do … end` block whose body is zero or more `line_atom`s (blank lines between them are skipped). The collected lines are captured under `key`.



43
44
45
46
47
# File 'lib/aura/parser.rb', line 43

def block_body(line_atom, key)
  str("do") >> eol >>
    (blank_lines >> line_atom).repeat.as(key) >>
    blank_lines >> sp >> str("end")
end