Module: Sexpr::Grammar

Includes:
Matching, Options, Parsing, Tagging
Defined in:
lib/sexpr/grammar.rb,
lib/sexpr/grammar/options.rb,
lib/sexpr/grammar/parsing.rb,
lib/sexpr/grammar/tagging.rb,
lib/sexpr/grammar/matching.rb

Defined Under Namespace

Modules: Matching, Options, Parsing, Tagging

Instance Attribute Summary

Attributes included from Options

#options, #parser, #path, #root, #rules

Class Method Summary collapse

Methods included from Tagging

#mod2rulename, #rule2modname, #sexpr

Methods included from Parsing

#parse

Methods included from Matching

#[], #match?, #root_rule

Methods included from Options

#compile_rules, #install_options, #install_parser, #install_path, #install_root, #install_rules, #option

Class Method Details

.new(options = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/sexpr/grammar.rb', line 12

def self.new(options = {})
  unless options.is_a?(Hash)
    raise ArgumentError, "Invalid grammar definition: #{options.inspect}"
  end
  Module.new.tap{|g|
    g.instance_eval{
      include(Grammar)
      extend(self)
      install_options(options)
    }
  }
end