Sha256: fcc83d18a51bc579f72437a67c0add553fb9f0ebb09751d59a89a8652c3177a5

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

require 'forwardable'
require 'treetop'

require 'ceml/script'
require 'ceml/casting_statement'
require 'ceml/instruction_statements'
require 'ceml/tt/lexer'
require 'ceml/tt/casting'
require 'ceml/tt/instructions'
require 'ceml/tt/scripts'

require 'ceml/role'
require 'ceml/confluence'
require 'ceml/incident'
require 'ceml/driver'

module CEML
  extend self
  attr_accessor :delegate
  # @delegate = Delegate.new
end

module CEML
  def parse(what, string)
    string.gsub!(/\n +/, ' ')
    what = case what
    when :script then :free_script
    when :scripts then :free_scripts
    else what
    end
    result = nil
    ScriptsParser.new.tap do |parser|
      result = parser.parse(string, :root => what)
      raise "parse failed: \n#{parser.failure_reason}" unless result
      case what
      when :free_scripts
        raise "no scripts found" unless result.scripts.list
        result = result.scripts.list
        result.each{ |s| s.validate! }
      when :free_script
        result = result.script
        result.validate!
      end
    end
    result
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ceml-0.6.0 lib/ceml.rb