Module: Bauxite::ParserModule

Included in:
Parser
Defined in:
lib/bauxite/core/parser.rb

Overview

Parser common state and behavior.

Instance Method Summary collapse

Instance Method Details

#initialize(ctx) ⇒ Object

Constructs a new test parser instance.



27
28
29
# File 'lib/bauxite/core/parser.rb', line 27

def initialize(ctx)
	@ctx = ctx
end

#parse(file) ⇒ Object

Parse file and yield the resulting actions.



32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/bauxite/core/parser.rb', line 32

def parse(file)
	actions = nil
	Context::parsers.any? { |p| actions = send(p, file) }
	
	unless actions
		raise Errors::FormatError, "Invalid format in '#{file}'. None of the available parsers can understand this file format."
	end
	
	actions.each do |action, args, text, line|
		yield action.strip.downcase, args, text, file, line
	end
end