# # DO NOT MODIFY!!!! # This file is automatically generated by racc 1.4.5 # from racc grammer file "lib/adl_parser.y". # require 'racc/parser' $:.unshift File.join(File.dirname(__FILE__)) $DEBUG = false module OpenEHR class ADLParser < Racc::Parser module_eval <<'..end lib/adl_parser.y modeval..id1ff841bfe3', 'lib/adl_parser.y', 93 ###----------/* keywords */ --------------------------------------------- @@reserved = { 'archetype' => :SYM_ARCHETYPE, 'adl_version' => :SYM_ADL_VERSION, 'controlled' => :SYM_IS_CONTROLLED, 'specialize' => :SYM_SPECIALIZE, 'concept' => :SYM_CONCEPT, 'language' => :SYM_LANGUAGE, 'description' => :SYM_DESCRIPTION, 'definition' => :SYM_DEFINITION, 'invariant' => :SYM_INVARIANT, 'ontology' => :SYM_ONTOLOGY, 'true' => :SYM_TRUE, #[Tt][Rr][Uu][Ee] -- -> SYM_TRUE 'false' => :SYM_FALSE, # [Ff][Aa][Ll][Ss][Ee] -- -> SYM_FALSE 'infinity' => :SYM_INFINITY # [Ii][Nn][Ff][Ii][Nn][Ii][Tt][Yy] -- -> SYM_INFINITY } ###----------/* Scanner */ ----------------------------------------------- def scan until @data.nil? do case @data when /\A\n/ # carriage return @lineno += 1 ; when /\A[ \t\r\f]+/ #just drop it ; when /\A--.*\n/ # single line comment @lineno += 1 ; ###----------/* symbols */ ------------------------------------------------- when /\A[a-zA-Z][a-zA-Z0-9_-]+\.[a-zA-Z][a-zA-Z0-9_-]+\.[a-zA-Z0-9]+/ #V_ARCHETYPE_ID yield :V_ARCHETYPE_ID, $& when /\A[a-z][a-zA-Z0-9_]*/ word = $&.downcase if @@reserved[word] yield @@reserved[word], @@reserved[word] end when /\A\=/ # = yield :SYM_EQ, :SYM_EQ when /\A\>=/ # >= yield :SYM_GE, :SYM_GE when /\A\<=/ # <= yield :SYM_LE, :SYM_LE when /\A\/ # > if @in_interval yield :SYM_GT, :SYM_GT else yield :SYM_END_DBLOCK, :SYM_END_DBLOCK end when /\A\-/ # - yield :Minus_code, :Minus_code when /\A\+/ # + yield :Plus_code, :Plus_code when /\A\*/ # * yield :Star_code, :Star_code when /\A\// # / yield :Slash_code, :Slash_code when /\A\^/ # ^ yield :Caret_code, :Caret_code when /\A\=/ # = yield :Equal_code, :Equal_code when /\A\./ # . yield :Dot_code, :Dot_code when /\A\;/ # ; yield :Semicolon_code, :Semicolon_code when /\A\,/ # , yield :Comma_code, :Comma_code when /\A\:/ # : yield :Colon_code, :Colon_code when /\A\!/ # ! yield :Exclamation_code, :Exclamation_code when /\A\(/ # ( yield :Left_parenthesis_code, :Left_parenthesis_code when /\A\)/ # ) yield :Right_parenthesis_code, :Right_parenthesis_code when /\A\$/ # $ yield :Dollar_code, :Dollar_code when /\A\?\?/ # ?? yield :SYM_DT_UNKNOWN, :SYM_DT_UNKNOWN when /\A\?/ # ? yield :Question_mark_code, :Question_mark_code when /\A[0-9]+\.[0-9]+(\.[0-9]+)*/ # ? yield :V_VERSION_STRING, :V_VERSION_STRING when /\A\[[a-zA-Z0-9][a-zA-Z0-9._\-]*\]/ #V_LOCAL_TERM_CODE_REF yield :V_LOCAL_TERM_CODE_REF, $& when /\A[a-zA-Z][a-zA-Z0-9_]*/ yield :V_IDENTIFIER, $& when /\A\|/ # | if @in_interval @in_interval = false elsif @start_block_received @in_interval = true @start_block_received = false end yield :SYM_INTERVAL_DELIM, :SYM_INTERVAL_DELIM when /\A\[/ # [ yield :Left_bracket_code, :Left_bracket_code when /\A\]/ # ] yield :Right_bracket_code, :Right_bracket_code when /\A\../ # .. yield :SYM_ELLIPSIS, :SYM_ELLIPSIS when /\A\.../ # ... yield :SYM_LIST_CONTINUE, :SYM_LIST_CONTINUE when /\A\[[a-zA-Z0-9._\-]+::[a-zA-Z0-9._\-]+\]/ #V_QUALIFIED_TERM_CODE_REF form [ICD10AM(1998)::F23] yield :V_QUALIFIED_TERM_CODE_REF, $& when /\A\[[a-zA-Z0-9._\- ]+::[a-zA-Z0-9._\- ]+\]/ #ERR_V_QUALIFIED_TERM_CODE_REF yield :ERR_V_QUALIFIED_TERM_CODE_REF, $& when /\Aa[ct][0-9.]+/ #V_LOCAL_CODE yield :V_LOCAL_CODE, $& when /\A[0-9]{4}-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-6][0-9]:[0-6][0-9](,[0-9]+)?(Z|[+-][0-9]{4})?|[0-9]{4}-[0-1][0-9]-[0-3][0-9]T[0-2][0-9]:[0-6][0-9](Z|[+-][0-9]{4})?|[0-9]{4}-[0-1][0-9]-[0-3][0-9]T[0-2][0-9](Z|[+-][0-9]{4})?/ #V_ISO8601_EXTENDED_DATE_TIME YYYY-MM-DDThh:mm:ss[,sss][Z|+/- -n-n-n-n-]- yield :V_ISO8601_EXTENDED_DATE_TIME, $& when /\A[0-2][0-9]:[0-6][0-9]:[0-6][0-9](,[0-9]+)?(Z|[+-][0-9]{4})?|[0-2][0-9]:[0-6][0-9](Z|[+-][0-9]{4})? / #V_ISO8601_EXTENDED_TIME hh:mm:ss[,sss][Z|+/-nnnn] yield :V_ISO8601_EXTENDED_TIME, $& when /\A[0-9]{4}-[0-1][0-9]-[0-3][0-9]|[0-9]{4}-[0-1][0-9]/ #V_ISO8601_EXTENDED_DATE YYYY-MM-DD yield :V_ISO8601_EXTENDED_DATE, $& when /\AP([0-9]+[yY])?([0-9]+[mM])?([0-9]+[wW])?([0-9]+[dD])?T([0-9]+[hH])?([0-9]+[mM])?([0-9]+[sS])?|P([0-9]+[yY])?([0-9]+[mM])?([0-9]+[wW])?([0-9]+[dD])?/ #V_ISO8601_DURATION PnYnMnWnDTnnHnnMnnS yield :V_ISO8601_DURATION, $& when /\A[A-Z][a-zA-Z0-9_]*/ #V_TYPE_IDENTIFIER yield :V_ISO8601_DURATION, $& when /\A[A-Z][a-zA-Z0-9_]*<[a-zA-Z0-9,_<>]+>/ #V_GENERIC_TYPE_IDENTIFIER yield :V_GENERIC_TYPE_IDENTIFIER, $& when /\A[0-9]+|[0-9]+[eE][+-]?[0-9]+/ #V_INTEGER yield :V_INTEGER, $& when /\A[0-9]+\.[0-9]+|[0-9]+\.[0-9]+[eE][+-]?[0-9]+ / #V_REAL yield :V_REAL, $& # when /\A"((?:[^"\\]+|\\.)*)"/ #V_STRING when /\A"([^"]*)"/m #V_STRING yield :V_STRING, $1 # \"[^\\\n"]*\" # \"[^\\\n"]*{ -- beginning of a multi-line string # { # \\\\ -- match escaped backslash, i.e. \\ -> \ # \\\" -- match escaped double quote, i.e. \” -> “ # {UTF8CHAR}+ -- match UTF8 chars # [^\\\n"]+ -- match any other characters # \\\n[ \t\r]* -- match LF in line # [^\\\n"]*\" -- match final end of string # .|\n | # <> -- unclosed String -> ERR_STRING # } # ###----------/* V_CHARACTER */ -------------------------------------------- # \'[^\\\n']\' -- normal character in 0-127 # \'\\n\ -- \n # \'\\r\ -- \r # \'\\t\ -- \t # \'\\'\ -- \’ # \'\\\\ -- \\ # \'{UTF8CHAR}\' -- UTF8 char # \'.{1,2} | # \'\\[0-9]+(\/)? -- invalid character -> ERR_CHARACTER when /\A[a-z]+:\/\/[^<>|\\{}^~"\[\] ]*/ #V_URI yield :V_URI, $& when /\A\S/ #UTF8CHAR yield :UTF8CHAR, $& end @data = $' # variable $' receives the string after the match end yield :EOF, nil yield false, '$' end # of scan def parse(data, filename, lineno = 1, debug = false) @yydebug = true @parsestring = data @data = data @lineno = lineno @filename = filename @in_interval = false @start_block_received = false @start_block_received = false yyparse self, :scan end def on_error( t, v, values) raise Racc::ParseError, "#{@filename}:#{@lineno}: Inline syntax error on #{v.inspect}" end # ###----------/* CADL Blocks */ ------------------------------------------- # \{[^{}]* -- beginning of CADL block # \{[^{}]* -- got an open brace # [^{}]*\} -- got a close brace ### Local Variables: ### mode:ruby ### mode:font-lock ### comment-column:0 ### comment-start: "### " ### comment-end:"" ### End: ..end lib/adl_parser.y modeval..id1ff841bfe3 ##### racc 1.4.5 generates ### racc_reduce_table = [ 0, 0, :racc_error, 1, 36, :_reduce_none, 8, 37, :_reduce_none, 2, 38, :_reduce_none, 1, 46, :_reduce_none, 2, 46, :_reduce_none, 3, 47, :_reduce_none, 1, 48, :_reduce_none, 3, 48, :_reduce_none, 3, 49, :_reduce_none, 1, 49, :_reduce_none, 0, 39, :_reduce_none, 2, 39, :_reduce_none, 2, 40, :_reduce_none, 0, 41, :_reduce_none, 2, 41, :_reduce_none, 0, 42, :_reduce_none, 2, 42, :_reduce_none, 2, 43, :_reduce_none, 0, 44, :_reduce_none, 2, 44, :_reduce_none, 2, 45, :_reduce_none ] racc_reduce_n = 22 racc_shift_n = 41 racc_action_table = [ 19, 19, 16, 16, 23, 24, 25, 11, 12, 13, 14, 5, 20, 21, 7, 8, 26, 27, 6, 30, 31, 32, 34, 36, 37, 39, 40 ] racc_action_check = [ 11, 24, 11, 24, 17, 17, 19, 5, 7, 8, 9, 0, 14, 15, 2, 4, 21, 22, 1, 25, 27, 28, 32, 33, 35, 36, 37 ] racc_action_pointer = [ -6, 2, 14, nil, -9, -11, nil, 8, -7, -15, nil, -21, nil, nil, -14, -14, nil, -15, nil, -2, nil, -12, -12, nil, -20, -3, nil, -8, -9, nil, nil, nil, -9, -9, nil, -10, -8, -2, nil, nil, nil ] racc_action_default = [ -22, -22, -22, -1, -11, -4, -3, -22, -22, -22, -5, -22, 41, -12, -22, -14, -10, -22, -7, -22, -13, -22, -16, -6, -22, -22, -15, -22, -22, -8, -9, -17, -22, -19, -18, -22, -22, -22, -2, -20, -21 ] racc_goto_table = [ 18, 33, 4, 9, 15, 22, 28, 3, 35, 38, 1, 10, 17, 29, 2 ] racc_goto_check = [ 14, 8, 3, 4, 5, 6, 7, 2, 9, 10, 11, 12, 13, 14, 1 ] racc_goto_pointer = [ nil, 14, 7, 2, -1, -5, -10, -16, -27, -25, -26, 10, 6, 1, -11 ] racc_goto_default = [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil ] racc_token_table = { false => 0, Object.new => 1, :UMINUS => 2, :UPLUS => 3, "*" => 4, "/" => 5, "+" => 6, "-" => 7, :SYM_EQ => 8, :SYM_NE => 9, :SYM_LT => 10, :SYM_START_DBLOCK => 11, :SYM_GT => 12, :SYM_END_DBLOCK => 13, :SYM_LE => 14, :SYM_GE => 15, :V_ARCHETYPE_ID => 16, :SYM_ARCHETYPE => 17, :Left_parenthesis_code => 18, :Right_parenthesis_code => 19, ";" => 20, :SYM_ADL_VERSION => 21, :V_VERSION_STRING => 22, :SYM_IS_CONTROLLED => 23, :SYM_SPECIALIZE => 24, :SYM_CONCEPT => 25, :V_LOCAL_TERM_CODE_REF => 26, :SYM_LANGUAGE => 27, :V_DADL_TEXT => 28, :SYM_DESCRIPTION => 29, :SYM_DEFINITION => 30, :V_CADL_TEXT => 31, :SYM_INVARIANT => 32, :V_ASSERTION_TEXT => 33, :SYM_ONTOLOGY => 34 } racc_use_result_var = true racc_nt_base = 35 Racc_arg = [ racc_action_table, racc_action_check, racc_action_default, racc_action_pointer, racc_goto_table, racc_goto_check, racc_goto_default, racc_goto_pointer, racc_nt_base, racc_reduce_table, racc_token_table, racc_shift_n, racc_reduce_n, racc_use_result_var ] Racc_token_to_s_table = [ '$end', 'error', 'UMINUS', 'UPLUS', '"*"', '"/"', '"+"', '"-"', 'SYM_EQ', 'SYM_NE', 'SYM_LT', 'SYM_START_DBLOCK', 'SYM_GT', 'SYM_END_DBLOCK', 'SYM_LE', 'SYM_GE', 'V_ARCHETYPE_ID', 'SYM_ARCHETYPE', 'Left_parenthesis_code', 'Right_parenthesis_code', '";"', 'SYM_ADL_VERSION', 'V_VERSION_STRING', 'SYM_IS_CONTROLLED', 'SYM_SPECIALIZE', 'SYM_CONCEPT', 'V_LOCAL_TERM_CODE_REF', 'SYM_LANGUAGE', 'V_DADL_TEXT', 'SYM_DESCRIPTION', 'SYM_DEFINITION', 'V_CADL_TEXT', 'SYM_INVARIANT', 'V_ASSERTION_TEXT', 'SYM_ONTOLOGY', '$start', 'input', 'archetype', 'arch_identification', 'arch_specialisation', 'arch_concept', 'arch_language', 'arch_description', 'arch_definition', 'arch_invariant', 'arch_ontology', 'arch_head', 'arch_meta_data', 'arch_meta_data_items', 'arch_meta_data_item'] Racc_debug_parser = true ##### racc system variables end ##### # reduce 0 omitted # reduce 1 omitted # reduce 2 omitted # reduce 3 omitted # reduce 4 omitted # reduce 5 omitted # reduce 6 omitted # reduce 7 omitted # reduce 8 omitted # reduce 9 omitted # reduce 10 omitted # reduce 11 omitted # reduce 12 omitted # reduce 13 omitted # reduce 14 omitted # reduce 15 omitted # reduce 16 omitted # reduce 17 omitted # reduce 18 omitted # reduce 19 omitted # reduce 20 omitted # reduce 21 omitted def _reduce_none( val, _values, result ) result end end # class ADLParser end # module OpenEHR