Module: SelfML

Defined in:
lib/selfml.rb,
lib/selfml.rb,
lib/selfml/parser.rb,
lib/selfml/version.rb

Overview

SelfML main module

Author:

  • Ricardo Mendes

Defined Under Namespace

Modules: AST, Engines Classes: Parser

Constant Summary collapse

VERSION =

SelfML::VERSION

"1.0.0"

Class Method Summary collapse

Class Method Details

.parse(source, engine = Engines::Document.new) ⇒ SelfML::Document

Returns a SelfML document

Parameters:

Returns:

  • (SelfML::Document)

    parsed document


20
21
22
23
24
25
26
27
28
# File 'lib/selfml.rb', line 20

def self.parse(source, engine=Engines::Document.new)
  transformer = engine.new if engine.instance_of? Class

  parser        = Parser.new
  transformer ||= Engines::Document.new
  
  tree = parser.parse(source)
  out  = transformer.apply(tree)
end