Sha256: 8913d98436fae29654470dca9efec77fc939d40c2a4723da929a22aafebae676

Contents?: true

Size: 1.14 KB

Versions: 12

Compression:

Stored size: 1.14 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
  @extra_seconds = 0
  def clock; Time.now.utc.to_i + @extra_seconds; end
  def incr_clock(s); @extra_seconds += s; end
end

module CEML
  def parse(what, string)
    string = string.dup
    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

12 entries across 12 versions & 1 rubygems

Version Path
ceml-0.7.13 lib/ceml.rb
ceml-0.7.11 lib/ceml.rb
ceml-0.7.9 lib/ceml.rb
ceml-0.7.7 lib/ceml.rb
ceml-0.7.5 lib/ceml.rb
ceml-0.7.4 lib/ceml.rb
ceml-0.7.3 lib/ceml.rb
ceml-0.7.2 lib/ceml.rb
ceml-0.7.1 lib/ceml.rb
ceml-0.7.0 lib/ceml.rb
ceml-0.6.4 lib/ceml.rb
ceml-0.6.3 lib/ceml.rb