Sha256: 96b41c8045d453156697c6a5ce3da79f9edab73eb3b53c3be73e0cb1d5f1b6ac
Contents?: true
Size: 1.82 KB
Versions: 3
Compression:
Stored size: 1.82 KB
Contents
require 'treetop' require 'polyglot' require_relative '../parser' module OpenEHR module Parser class ADLParser < ::OpenEHR::Parser::Base Treetop.load(File.dirname(__FILE__)+'/adl_grammar.tt') def initialize(filename) super(filename) file = File.open(filename, 'r:bom|utf-8') data = file.read ap = ADLGrammarParser.new @result = ap.parse(data) file.close unless @result puts ap.failure_reason puts ap.failure_line puts ap.failure_column end end def parse archetype_id = OpenEHR::RM::Support::Identification::ArchetypeID.new(:value => @result.archetype_id) definition = @result.definition ontology = @result.ontology original_language = nil if @result.original_language original_language = @result.original_language else terminology_id = OpenEHR::RM::Support::Identification::TerminologyID.new(:value => 'ISO639-1') original_language = OpenEHR::RM::DataTypes::Text::CodePhrase.new(:terminology_id => terminology_id, :code_string =>ontology.primary_language) end archetype = OpenEHR::AM::Archetype::Archetype.new(:archetype_id => archetype_id, :adl_version => @result.adl_version, :concept => @result.concept, :original_language => original_language, :translations => @result.translations, :description => @result.description, :definition => @result.definition, :ontology => @result.ontology) return archetype end end end # of Parser end # of OpenEHR
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
openehr-1.2.11 | lib/openehr/parser/adl_parser.rb |
openehr-1.2.10 | lib/openehr/parser/adl_parser.rb |
openehr-1.2.9 | lib/openehr/parser/adl_parser.rb |