Class: MTK::Lang::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/mtk/lang/parser.rb

Overview

Parser for the MTK grammar

Class Method Summary collapse

Class Method Details

.parse(syntax, root = :root, dump = false) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/mtk/lang/parser.rb', line 18

def self.parse(syntax, root=:root, dump=false)
  syntax = syntax.to_s.strip
  return nil if syntax.empty?
  matcher = ::MTK_Grammar.parse(syntax, :root => root)
  puts matcher.dump if dump
  matcher.value
end