lib/openehr/parser/adl_parser.rb in openehr-1.2.99 vs lib/openehr/parser/adl_parser.rb in openehr-1.2.999

- old
+ new

@@ -1,18 +1,18 @@ require 'treetop' -require 'polyglot' +#require 'polyglot' require_relative '../parser' +require_relative './adl_grammar' module OpenEHR module Parser class ADLParser < ::OpenEHR::Parser::Base - require_relative './adl_grammar' -# Treetop.load('adl_grammar') +# Treetop.load(File.join(File.dirname(__FILE__), 'adl_grammar.tt')) def initialize(filename) - super(filename) + super end def parse archetype end @@ -22,16 +22,17 @@ def adl_grammar_parser @adl_grammar_parser ||= ADLGrammarParser.new end def parsed_data - filestream = File.open(filename, 'r:bom|utf-8') + filestream = File.open(@filename, 'rb:bom|utf-8') @parsed_data ||= adl_grammar_parser.parse(filestream.read) filestream.close unless @parsed_data puts adl_grammar_parser.failure_reason puts adl_grammar_parser.failure_line puts adl_grammar_parser.failure_column + raise ParseError, 'Invalid ADL' end @parsed_data end def archetype_id