Index: /ruby/trunk/adl_parser/Rakefile
===================================================================
--- /ruby/trunk/adl_parser/Rakefile	(revision 16)
+++ /ruby/trunk/adl_parser/Rakefile	(revision 17)
@@ -36,5 +36,5 @@
 
 desc "Whole Unit tests"
-task 'test' => ['test:shell', 'test:validator', 'test:parser']
+task 'test' => ['test:shell', 'test:validator', 'test:parser', 'test:scanner']
 
 
@@ -60,4 +60,11 @@
 end
 
+Rake::TestTask.new('test:scanner') do |t|
+  t.libs = ["lib"]
+  t.pattern = ['tests/scanner_test.rb']
+  t.warning = true
+  t.verbose = true
+end
+
 
 Rake::RDocTask.new('rdoc') do |t|
@@ -71,5 +78,5 @@
   s.name = 'adl_parser'
   s.author = 'Akimichi Tatsukawa'
-  s.version = '0.0.1'
+  s.version = '0.0.2'
   s.summary = 'ADL parser'
   s.email = 'akimichi_tatsukawa@nifty.com'
@@ -83,4 +90,5 @@
   s.has_rdoc = true
   s.extra_rdoc_files = ["README"]
+  s.add_dependency("yaparc", ">= 0.2.0")
 end
 
Index: by/trunk/adl_parser/lib/adl_parser.y
===================================================================
--- /ruby/trunk/adl_parser/lib/adl_parser.y	(revision 16)
+++ 	(revision )
@@ -1,301 +1,0 @@
-
-
-class OpenEHR::ADLParser
-
-#options omit_action_call
-
-prechigh
-
-  nonassoc UMINUS UPLUS
-  left '*' '/'
-  left '+' '-'
-
-#  left DOUBLE_BAR
-
-  nonassoc SYM_EQ
-  nonassoc SYM_NE
-  nonassoc SYM_LT
-  nonassoc SYM_START_DBLOCK
-  nonassoc SYM_GT
-  nonassoc SYM_END_DBLOCK
-  nonassoc SYM_LE
-  nonassoc SYM_GE
-
-preclow
-
-
-rule
-### http://svn.openehr.org/ref_impl_eiffel/TRUNK/components/adl_parser/src/syntax/adl/parser/adl_validator.y
-
-input: archetype
-#  | error
-
-archetype: arch_identification
-  arch_specialisation
-  arch_concept
-  arch_language
-  arch_description
-  arch_definition
-  arch_invariant
-  arch_ontology
-
-
-arch_identification: arch_head V_ARCHETYPE_ID
-#  | SYM_ARCHETYPE error
-
-arch_head: SYM_ARCHETYPE
-  | SYM_ARCHETYPE arch_meta_data
-
-arch_meta_data: Left_parenthesis_code arch_meta_data_items Right_parenthesis_code
-
-arch_meta_data_items: arch_meta_data_item
-  | arch_meta_data_items ';' arch_meta_data_item
-
-arch_meta_data_item: SYM_ADL_VERSION SYM_EQ V_VERSION_STRING
-  | SYM_IS_CONTROLLED
-
-# Define specialization in which its constraints are narrower than those of the parent.
-# Any data created via the use of the specialized archetype shall be conformant both to it and its parent.
-arch_specialisation: #-- empty is ok
-  | SYM_SPECIALIZE V_ARCHETYPE_ID
-#  | SYM_SPECIALIZE error
-
-arch_concept: SYM_CONCEPT V_LOCAL_TERM_CODE_REF
-#  | SYM_CONCEPT error
-
-arch_language: #-- empty is ok for ADL 1.4 tools
-    | SYM_LANGUAGE V_DADL_TEXT
-#  | SYM_LANGUAGE error
-
-arch_description: #-- no meta-data ok
-    | SYM_DESCRIPTION V_DADL_TEXT
-#  | SYM_DESCRIPTION error
-
-arch_definition: SYM_DEFINITION V_CADL_TEXT
-#  | SYM_DEFINITION error
-
-arch_invariant: #-- no invariant ok
-    | SYM_INVARIANT V_ASSERTION_TEXT
-#  | SYM_INVARIANT error
-
-# define all linguistic entries in this part as dADL.
-arch_ontology: SYM_ONTOLOGY V_DADL_TEXT
-#  | SYM_ONTOLOGY error
-
-
----- header
-
-$:.unshift File.join(File.dirname(__FILE__))
-$DEBUG = false
-
-
----- inner
-###----------/* 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
-        @start_block_received = false
-        yield :SYM_LT, :SYM_LT
-      else
-        @start_block_received = true
-        yield :SYM_START_DBLOCK, :SYM_START_DBLOCK
-      end
-    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 
-# <IN_STR> { 
-# \\\\ -- 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 | 
-# <<EOF>> -- 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 
-# <IN_CADL_BLOCK>\{[^{}]* -- got an open brace 
-# <IN_CADL_BLOCK>[^{}]*\} -- got a close brace 
-
-
-
-
-
-
-### Local Variables:
-### mode:ruby
-### mode:font-lock
-### comment-column:0
-### comment-start: "### "
-### comment-end:"" 
-### End:
-
-
-
-
Index: /ruby/trunk/adl_parser/lib/adl_parser.y.bak
===================================================================
--- /ruby/trunk/adl_parser/lib/adl_parser.y.bak	(revision 17)
+++ /ruby/trunk/adl_parser/lib/adl_parser.y.bak	(revision 17)
@@ -0,0 +1,301 @@
+
+
+class OpenEHR::ADLParser
+
+#options omit_action_call
+
+prechigh
+
+  nonassoc UMINUS UPLUS
+  left '*' '/'
+  left '+' '-'
+
+#  left DOUBLE_BAR
+
+  nonassoc SYM_EQ
+  nonassoc SYM_NE
+  nonassoc SYM_LT
+  nonassoc SYM_START_DBLOCK
+  nonassoc SYM_GT
+  nonassoc SYM_END_DBLOCK
+  nonassoc SYM_LE
+  nonassoc SYM_GE
+
+preclow
+
+
+rule
+### http://svn.openehr.org/ref_impl_eiffel/TRUNK/components/adl_parser/src/syntax/adl/parser/adl_validator.y
+
+input: archetype
+#  | error
+
+archetype: arch_identification
+  arch_specialisation
+  arch_concept
+  arch_language
+  arch_description
+  arch_definition
+  arch_invariant
+  arch_ontology
+
+
+arch_identification: arch_head V_ARCHETYPE_ID
+#  | SYM_ARCHETYPE error
+
+arch_head: SYM_ARCHETYPE
+  | SYM_ARCHETYPE arch_meta_data
+
+arch_meta_data: Left_parenthesis_code arch_meta_data_items Right_parenthesis_code
+
+arch_meta_data_items: arch_meta_data_item
+  | arch_meta_data_items ';' arch_meta_data_item
+
+arch_meta_data_item: SYM_ADL_VERSION SYM_EQ V_VERSION_STRING
+  | SYM_IS_CONTROLLED
+
+# Define specialization in which its constraints are narrower than those of the parent.
+# Any data created via the use of the specialized archetype shall be conformant both to it and its parent.
+arch_specialisation: #-- empty is ok
+  | SYM_SPECIALIZE V_ARCHETYPE_ID
+#  | SYM_SPECIALIZE error
+
+arch_concept: SYM_CONCEPT V_LOCAL_TERM_CODE_REF
+#  | SYM_CONCEPT error
+
+arch_language: #-- empty is ok for ADL 1.4 tools
+    | SYM_LANGUAGE V_DADL_TEXT
+#  | SYM_LANGUAGE error
+
+arch_description: #-- no meta-data ok
+    | SYM_DESCRIPTION V_DADL_TEXT
+#  | SYM_DESCRIPTION error
+
+arch_definition: SYM_DEFINITION V_CADL_TEXT
+#  | SYM_DEFINITION error
+
+arch_invariant: #-- no invariant ok
+    | SYM_INVARIANT V_ASSERTION_TEXT
+#  | SYM_INVARIANT error
+
+# define all linguistic entries in this part as dADL.
+arch_ontology: SYM_ONTOLOGY V_DADL_TEXT
+#  | SYM_ONTOLOGY error
+
+
+---- header
+
+$:.unshift File.join(File.dirname(__FILE__))
+$DEBUG = false
+
+
+---- inner
+###----------/* 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
+        @start_block_received = false
+        yield :SYM_LT, :SYM_LT
+      else
+        @start_block_received = true
+        yield :SYM_START_DBLOCK, :SYM_START_DBLOCK
+      end
+    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 
+# <IN_STR> { 
+# \\\\ -- 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 | 
+# <<EOF>> -- 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 
+# <IN_CADL_BLOCK>\{[^{}]* -- got an open brace 
+# <IN_CADL_BLOCK>[^{}]*\} -- got a close brace 
+
+
+
+
+
+
+### Local Variables:
+### mode:ruby
+### mode:font-lock
+### comment-column:0
+### comment-start: "### "
+### comment-end:"" 
+### End:
+
+
+
+
Index: by/trunk/adl_parser/lib/cparser.y
===================================================================
--- /ruby/trunk/adl_parser/lib/cparser.y	(revision 16)
+++ 	(revision )
@@ -1,643 +1,0 @@
-
-
-class OpenEHR::CADLParser
-
-#options omit_action_call
-
-prechigh
-
-  nonassoc UMINUS UPLUS
-#  left '*' '/'
-  left Star_code Slash_code
-  left '+' '-'
-
-  nonassoc SYM_EQ
-  nonassoc SYM_NE
-  nonassoc SYM_LT
-  nonassoc SYM_START_DBLOCK
-  nonassoc SYM_GT
-  nonassoc SYM_END_DBLOCK
-  nonassoc SYM_LE
-  nonassoc SYM_GE
-
-preclow
-
-
-rule
-  ### http://svn.openehr.org/ref_impl_eiffel/TRUNK/components/adl_parser/src/syntax/cadl/parser/cadl_validator.y
-
-cadl: input EOF
-input: c_complex_object
-  | assertions
-#  | error
-
-c_complex_object: c_complex_object_head SYM_MATCHES SYM_START_CBLOCK c_complex_object_body SYM_END_CBLOCK
-
-c_complex_object_head: c_complex_object_id c_occurrences
-
-c_complex_object_id: type_identifier
-  | type_identifier V_LOCAL_TERM_CODE_REF
-
-c_complex_object_body: c_any #-- used to indicate that any value of a type is ok
-  | c_attributes
-
-
-#------------------------- node types -----------------------
-
-c_object: c_complex_object
-  | archetype_internal_ref
-  | archetype_slot
-  | constraint_ref
-  | c_code_phrase
-  | c_ordinal
-  | c_primitive_object
-  | v_c_domain_type
-#  | V_C_DOMAIN_TYPE
-  | ERR_C_DOMAIN_TYPE
-  | error
-
-
-# 'archetype_internal_ref' is a node that refers to a previously defined object node in the same archetype.
-archetype_internal_ref: SYM_USE_NODE type_identifier c_occurrences absolute_path
-  | SYM_USE_NODE type_identifier error
-
-# 'archetype_slot' is a node whose statements define a constraint that determines which other archetypes may appear at that point in the current archetype.
-archetype_slot: c_archetype_slot_head SYM_MATCHES SYM_START_CBLOCK c_includes c_excludes SYM_END_CBLOCK
-
-c_archetype_slot_head: c_archetype_slot_id c_occurrences
-
-c_archetype_slot_id: SYM_ALLOW_ARCHETYPE type_identifier
-  | SYM_ALLOW_ARCHETYPE type_identifier V_LOCAL_TERM_CODE_REF
-  | SYM_ALLOW_ARCHETYPE error
-
-# 'c_primitive_object' is an node representing a constraint on a primitive object type.
-c_primitive_object: c_primitive
-
-c_primitive: c_integer
-  | c_real
-  | c_date
-  | c_time
-  | c_date_time
-  | c_duration
-  | c_string
-  | c_boolean
-
-c_any: Star_code
-#c_any: '*'
-
-#---------------- BODY - relationships ----------------
-
-c_attributes: c_attribute
-  | c_attributes c_attribute
-
-# 'c_attribute' is a node representing a constraint on an attribute in an object model.
-c_attribute: c_attr_head SYM_MATCHES SYM_START_CBLOCK c_attr_values SYM_END_CBLOCK
-  | c_attr_head SYM_MATCHES SYM_START_CBLOCK error SYM_END_CBLOCK
-
-
-c_attr_head: V_ATTRIBUTE_IDENTIFIER c_existence
-  | V_ATTRIBUTE_IDENTIFIER c_existence c_cardinality
-
-c_attr_values: c_object
-  | c_attr_values c_object
-  | c_any #	-- to allow a property to have any value
-
-c_includes: #-- Empty
-    | SYM_INCLUDE assertions
-
-c_excludes: #-- Empty
-    | SYM_EXCLUDE assertions
-
-
-#---------------------- ASSERTIONS ------------------------
-
-assertions: assertion
-  | assertions assertion
-
-assertion: any_identifier ':' boolean_expression
-  | boolean_expression
-#  | any_identifier ':' error
-
-#---------------------- expressions ---------------------
-
-boolean_expression: boolean_leaf
-  | boolean_node
-
-boolean_node: SYM_EXISTS absolute_path
-#  | SYM_EXISTS error
-  | relative_path SYM_MATCHES SYM_START_CBLOCK c_primitive SYM_END_CBLOCK
-  | SYM_NOT boolean_leaf
-  | arithmetic_expression '=' arithmetic_expression
-  | arithmetic_expression SYM_NE arithmetic_expression
-  | arithmetic_expression SYM_LT arithmetic_expression
-  | arithmetic_expression SYM_GT arithmetic_expression
-  | arithmetic_expression SYM_LE arithmetic_expression
-  | arithmetic_expression SYM_GE arithmetic_expression
-  | boolean_expression SYM_AND boolean_expression
-  | boolean_expression SYM_OR boolean_expression
-  | boolean_expression SYM_XOR boolean_expression
-  | boolean_expression SYM_IMPLIES boolean_expression
-
-boolean_leaf: Left_parenthesis_code boolean_expression Right_parenthesis_code
-  | SYM_TRUE
-  | SYM_FALSE
-
-arithmetic_expression: arithmetic_leaf
-  | arithmetic_node
-
-arithmetic_node: arithmetic_expression '+' arithmetic_leaf
-  | arithmetic_expression '-' arithmetic_leaf
-  | arithmetic_expression Star_code arithmetic_leaf
-  | arithmetic_expression Slash_code arithmetic_leaf
-  | arithmetic_expression '^' arithmetic_leaf
-
-arithmetic_leaf:  Left_parenthesis_code arithmetic_expression Right_parenthesis_code
-  | integer_value
-  | real_value
-  | absolute_path
-
-
-#--------------- THE FOLLOWING SOURCE TAKEN FROM OG_PATH_VALIDATOR.Y - DO NOT MODIFY  -------------
-#--------------- except to remove movable_path ----------------------------------------------------
-
-absolute_path: Slash_code
-  | Slash_code relative_path
-  | absolute_path Slash_code relative_path
-
-relative_path: path_segment
-  | relative_path Slash_code path_segment
-
-path_segment: V_ATTRIBUTE_IDENTIFIER V_LOCAL_TERM_CODE_REF
-  | V_ATTRIBUTE_IDENTIFIER
-
-
-#-------------------------------- END SOURCE TAKEN FROM OG_PATH_VALIDATOR.Y ----------------------
-
-
-#---------------- existence, occurrences, cardinality ----------------
-
-c_existence: #-- default to 1..1
-    | SYM_EXISTENCE SYM_MATCHES SYM_START_CBLOCK existence_spec SYM_END_CBLOCK
-
-existence_spec:  V_INTEGER #-- can only be 0 or 1
-  | V_INTEGER SYM_ELLIPSIS V_INTEGER #-- can only be 0..0, 0..1, 1..1
-
-c_cardinality: SYM_CARDINALITY SYM_MATCHES SYM_START_CBLOCK cardinality_spec SYM_END_CBLOCK
-
-cardinality_spec: occurrence_spec
-  | occurrence_spec Semicolon_code SYM_ORDERED
-  | occurrence_spec Semicolon_code SYM_UNORDERED
-  | occurrence_spec Semicolon_code SYM_UNIQUE
-  | occurrence_spec Semicolon_code SYM_ORDERED Semicolon_code SYM_UNIQUE
-  | occurrence_spec Semicolon_code SYM_UNORDERED Semicolon_code SYM_UNIQUE
-  | occurrence_spec Semicolon_code SYM_UNIQUE Semicolon_code SYM_ORDERED
-  | occurrence_spec Semicolon_code SYM_UNIQUE Semicolon_code SYM_UNORDERED
-
-cardinality_limit_value: integer_value
-  | Star_code
-#  | '*'
-
-c_occurrences:  #-- default to 1..1
-  | SYM_OCCURRENCES SYM_MATCHES SYM_START_CBLOCK occurrence_spec SYM_END_CBLOCK
-#  | SYM_OCCURRENCES error
-
-occurrence_spec: cardinality_limit_value #-- single integer or '*'
-  | V_INTEGER SYM_ELLIPSIS cardinality_limit_value
-
-#---------------------- leaf constraint types -----------------------
-
-c_integer_spec: integer_value
-  | integer_list_value
-  | integer_interval_value
-
-c_integer: c_integer_spec
-  | c_integer_spec Semicolon_code integer_value
-  | c_integer_spec Semicolon_code error
-
-c_real_spec: real_value
-  | real_list_value
-  | real_interval_value
-
-c_real: c_real_spec
-  | c_real_spec Semicolon_code real_value
-  | c_real_spec Semicolon_code error
-
-c_date_constraint: V_ISO8601_DATE_CONSTRAINT_PATTERN
-  | date_value
-  | date_interval_value
-
-c_date: c_date_constraint
-  | c_date_constraint Semicolon_code date_value
-  | c_date_constraint Semicolon_code error
-
-c_time_constraint: V_ISO8601_TIME_CONSTRAINT_PATTERN
-  | time_value
-  | time_interval_value
-
-c_time: c_time_constraint
-  | c_time_constraint Semicolon_code time_value
-  | c_time_constraint Semicolon_code error
-
-c_date_time_constraint: V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN
-  | date_time_value
-  | date_time_interval_value
-
-c_date_time: c_date_time_constraint
-  | c_date_time_constraint Semicolon_code date_time_value
-  | c_date_time_constraint Semicolon_code error
-
-c_duration_constraint: duration_pattern
-  | duration_pattern Slash_code duration_interval_value
-  | duration_value
-  | duration_interval_value
-
-c_duration: c_duration_constraint
-  | c_duration_constraint Semicolon_code duration_value
-  | c_duration_constraint Semicolon_code error
-
-c_string_spec:  V_STRING #-- single value, generates closed list
-  | string_list_value #-- closed list
-  | string_list_value ',' SYM_LIST_CONTINUE #-- open list
-  | V_REGEXP #-- regular expression with "//" or "^^" delimiters
-
-c_string: c_string_spec
-  | c_string_spec Semicolon_code string_value
-#  | c_string_spec Semicolon_code error
-
-c_boolean_spec: SYM_TRUE
-  | SYM_FALSE
-  | SYM_TRUE ',' SYM_FALSE
-  | SYM_FALSE ',' SYM_TRUE
-
-c_boolean: c_boolean_spec
-  | c_boolean_spec Semicolon_code boolean_value
-#  | c_boolean_spec ';' error
-
-c_ordinal: c_ordinal_spec
-  | c_ordinal_spec Semicolon_code integer_value
-#  | c_ordinal_spec ';' error
-
-c_ordinal_spec: ordinal
-  | c_ordinal_spec ',' ordinal
-
-ordinal: integer_value SYM_INTERVAL_DELIM V_QUALIFIED_TERM_CODE_REF
-
-c_code_phrase: V_TERM_CODE_CONSTRAINT #-- e.g. "[local::at0040, at0041; at0040]"
-  | V_QUALIFIED_TERM_CODE_REF
-
-# A Constraint_Ref is a proxy for a set of constraints on an object.
-constraint_ref: V_LOCAL_TERM_CODE_REF #-- e.g. "ac0003"
-
-any_identifier: type_identifier
-  | V_ATTRIBUTE_IDENTIFIER
-
-
-#----------------- TAKEN FROM DADL_VALIDATOR.Y -------------------
-#-----------------        DO NOT MODIFY        -------------------
-#---------------------- BASIC DATA VALUES -----------------------
-
-type_identifier: V_TYPE_IDENTIFIER
-  | V_GENERIC_TYPE_IDENTIFIER
-
-string_value: V_STRING
-
-string_list_value: V_STRING ',' V_STRING
-  | string_list_value ',' V_STRING
-  | V_STRING ',' SYM_LIST_CONTINUE
-
-integer_value: V_INTEGER
-  | '+' V_INTEGER
-  | '-' V_INTEGER
-
-integer_list_value: integer_value ',' integer_value
-  | integer_list_value ',' integer_value
-  | integer_value ',' SYM_LIST_CONTINUE
-
-integer_interval_value: SYM_INTERVAL_DELIM integer_value SYM_ELLIPSIS integer_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT integer_value SYM_ELLIPSIS integer_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM integer_value SYM_ELLIPSIS SYM_LT integer_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT integer_value SYM_ELLIPSIS SYM_LT integer_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_LT integer_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_LE integer_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT integer_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GE integer_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM integer_value SYM_INTERVAL_DELIM
-
-real_value: V_REAL
-  | '+' V_REAL
-  | '-' V_REAL
-
-real_list_value: real_value ',' real_value
-  | real_list_value ',' real_value
-  | real_value ',' SYM_LIST_CONTINUE
-
-real_interval_value: SYM_INTERVAL_DELIM real_value SYM_ELLIPSIS real_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT real_value SYM_ELLIPSIS real_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM real_value SYM_ELLIPSIS SYM_LT real_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT real_value SYM_ELLIPSIS SYM_LT real_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_LT real_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_LE real_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT real_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GE real_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM real_value SYM_INTERVAL_DELIM
-
-boolean_value: SYM_TRUE
-  | SYM_FALSE
-
-boolean_list_value: boolean_value ',' boolean_value
-  | boolean_list_value ',' boolean_value
-  | boolean_value ',' SYM_LIST_CONTINUE
-
-character_value: V_CHARACTER
-
-character_list_value: character_value ',' character_value
-  | character_list_value ',' character_value
-  | character_value ',' SYM_LIST_CONTINUE
-
-date_value: V_ISO8601_EXTENDED_DATE #-- in ISO8601 form yyyy-MM-dd
-
-date_list_value: date_value ',' date_value
-  | date_list_value ',' date_value
-  | date_value ',' SYM_LIST_CONTINUE
-
-date_interval_value: SYM_INTERVAL_DELIM date_value SYM_ELLIPSIS date_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT date_value SYM_ELLIPSIS date_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM date_value SYM_ELLIPSIS SYM_LT date_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT date_value SYM_ELLIPSIS SYM_LT date_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_LT date_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_LE date_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT date_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GE date_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM date_value SYM_INTERVAL_DELIM
-
-time_value: V_ISO8601_EXTENDED_TIME
-
-time_list_value: time_value ',' time_value
-  | time_list_value ',' time_value
-  | time_value ',' SYM_LIST_CONTINUE
-
-time_interval_value: SYM_INTERVAL_DELIM time_value SYM_ELLIPSIS time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT time_value SYM_ELLIPSIS time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM time_value SYM_ELLIPSIS SYM_LT time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT time_value SYM_ELLIPSIS SYM_LT time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_LT time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_LE time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GE time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM time_value SYM_INTERVAL_DELIM
-
-date_time_value: V_ISO8601_EXTENDED_DATE_TIME
-
-date_time_list_value: date_time_value ',' date_time_value
-  | date_time_list_value ',' date_time_value
-  | date_time_value ',' SYM_LIST_CONTINUE
-
-date_time_interval_value: SYM_INTERVAL_DELIM date_time_value SYM_ELLIPSIS date_time_value  SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT date_time_value SYM_ELLIPSIS date_time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM date_time_value SYM_ELLIPSIS SYM_LT date_time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT date_time_value SYM_ELLIPSIS SYM_LT date_time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_LT date_time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_LE date_time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT date_time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GE date_time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM date_time_value SYM_INTERVAL_DELIM
-
-duration_pattern: V_ISO8601_DURATION_CONSTRAINT_PATTERN
-
-duration_value: V_ISO8601_DURATION
-
-duration_list_value: duration_value ',' duration_value
-  | duration_list_value ',' duration_value
-  | duration_value ',' SYM_LIST_CONTINUE
-
-duration_interval_value: SYM_INTERVAL_DELIM duration_value SYM_ELLIPSIS duration_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT duration_value SYM_ELLIPSIS duration_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM duration_value SYM_ELLIPSIS SYM_LT duration_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT duration_value SYM_ELLIPSIS SYM_LT duration_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_LT duration_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_LE duration_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT duration_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GE duration_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM duration_value SYM_INTERVAL_DELIM
-
-term_code: V_QUALIFIED_TERM_CODE_REF
-  | ERR_V_QUALIFIED_TERM_CODE_REF
-
-term_code_list_value: term_code ',' term_code
-  | term_code_list_value ',' term_code
-  | term_code ',' SYM_LIST_CONTINUE
-
-uri_value: V_URI
-
-
----- header
-
-$:.unshift File.join(File.dirname(__FILE__))
-$DEBUG = false
-
-
----- inner
-###----------/* keywords */ --------------------------------------------- 
-@@reserved = {
-  'then' => :SYM_THEN,
-  'else' => :SYM_ELSE,
-  'and' => :SYM_AND,
-  'or' => :SYM_OR,
-  'xor' => :SYM_XOR,
-  'not' => :SYM_NOT,
-  'implies' => :SYM_IMPLIES,
-  'true' => :SYM_TRUE, #[Tt][Rr][Uu][Ee] -- -> SYM_TRUE 
-  'false' => :SYM_FALSE, # [Ff][Aa][Ll][Ss][Ee] -- -> SYM_FALSE 
-  'forall' => :SYM_FORALL,
-  'exists' => :SYM_EXISTS,
-  'existence' => :SYM_EXISTENCE,
-  'occurrences' => :SYM_OCCURRENCES,
-  'cardinality' => :SYM_CARDINALITY,
-  'ordered' => :SYM_ORDERED,
-  'unordered' => :SYM_UNORDERED,
-  'unique' => :SYM_UNIQUE,
-  'matches' => :SYM_MATCHES,
-  'is_in' => :SYM_MATCHES,
-  'invariant' => :SYM_INVARIANT,
-  'infinity' => :SYM_INFINITY, # [Ii][Nn][Ff][Ii][Nn][Ii][Tt][Yy] -- -> SYM_INFINITY 
-  'use_archetype' => :SYM_ALLOW_ARCHETYPE,
-  'allow_archetype' => :SYM_ALLOW_ARCHETYPE,
-  'include' => :SYM_INCLUDE,
-  'exclude' => :SYM_EXCLUDE
-}
-
-###----------/* 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\=/   # =
-      yield :SYM_EQ, :SYM_EQ
-    when /\A\>=/   # >=
-      yield :SYM_GE, :SYM_GE
-    when /\A\<=/   # <=
-      yield :SYM_LE, :SYM_LE
-    when /\A\</   # <
-      yield :SYM_LT, :SYM_LT
-    when /\A\>/   # >
-      yield :SYM_GT, :SYM_GT
-    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 :SYM_ELLIPSIS, :SYM_ELLIPSIS
-    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 :SYM_START_CBLOCK, :SYM_START_CBLOCK
-    when /\A\}/   # {
-      yield :SYM_END_CBLOCK, :SYM_END_CBLOCK
-    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\|/   # |
-      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\[[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 /\A\[([a-zA-Z0-9()._\-]+::[a-zA-Z0-9._\_-]+)\]/
-      yield :V_TERM_CODE_CONSTRAINT, :V_TERM_CODE_CONSTRAINT
-    when /\A\[[a-zA-Z0-9][a-zA-Z0-9._\-]*\]/   #V_LOCAL_TERM_CODE_REF
-      yield :V_LOCAL_TERM_CODE_REF, $&
-    when /\A\[/   # [
-      yield :Left_bracket_code, :Left_bracket_code
-    when /\A\]/   # ]
-      yield :Right_bracket_code, :Right_bracket_code
-    when /\A\.../   # ...
-      yield :SYM_LIST_CONTINUE, :SYM_LIST_CONTINUE
-    when /\A[a-z][a-zA-Z0-9_]*/
-      word = $&.downcase
-      if @@reserved[word]
-        yield @@reserved[word], @@reserved[word]
-      else #V_ATTRIBUTE_IDENTIFIER /\A[a-z][a-zA-Z0-9_]*/ 
-        yield :V_ATTRIBUTE_IDENTIFIER, $&
-      end
-    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[yY][yY][yY][yY]-[mM?X][mM?X]-[dD?X][dD?X]/
-      yield :V_ISO8601_DATE_CONSTRAINT_PATTERN, $&
-    when /\A[hH][hH]:[mM?X][mM?X]:[sS?X][sS?X]/
-      yield :V_ISO8601_TIME_CONSTRAINT_PATTERN, $&
-    when /\A[yY][yY][yY][yY]-[mM?X][mM?X]-[dD?X][dD?X][\t][hH?X][hH?X]:[mM?X][mM?X]:[sS?X][sS?X]/
-      yield :V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN, $&
-    when /\A[A-Z][a-zA-Z0-9_]*/
-      yield :V_TYPE_IDENTIFIER, $&
-    when /\A[a-z][a-zA-Z0-9_]*/
-      yield :V_ATTRIBUTE_IDENTIFIER, $&
-    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
-###     when /\A{\// #V_REGEXP
-###       if @in_regexp
-###         @in_regexp = false
-###       elsif @start_block_received
-###         @in_interval = true
-###         @start_block_received = false
-###       end
-###       yield :V_REGEXP, :V_REGEXP
-    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 
-# <IN_CADL_BLOCK>\{[^{}]* -- got an open brace 
-# <IN_CADL_BLOCK>[^{}]*\} -- got a close brace 
-
-
-
-
-
-
-### Local Variables:
-### mode:ruby
-### mode:font-lock
-### comment-column:0
-### comment-start: "### "
-### comment-end:"" 
-### End:
-
-
-
-
Index: /ruby/trunk/adl_parser/lib/cparser.y.bak
===================================================================
--- /ruby/trunk/adl_parser/lib/cparser.y.bak	(revision 17)
+++ /ruby/trunk/adl_parser/lib/cparser.y.bak	(revision 17)
@@ -0,0 +1,643 @@
+
+
+class OpenEHR::CADLParser
+
+#options omit_action_call
+
+prechigh
+
+  nonassoc UMINUS UPLUS
+#  left '*' '/'
+  left Star_code Slash_code
+  left '+' '-'
+
+  nonassoc SYM_EQ
+  nonassoc SYM_NE
+  nonassoc SYM_LT
+  nonassoc SYM_START_DBLOCK
+  nonassoc SYM_GT
+  nonassoc SYM_END_DBLOCK
+  nonassoc SYM_LE
+  nonassoc SYM_GE
+
+preclow
+
+
+rule
+  ### http://svn.openehr.org/ref_impl_eiffel/TRUNK/components/adl_parser/src/syntax/cadl/parser/cadl_validator.y
+
+cadl: input EOF
+input: c_complex_object
+  | assertions
+#  | error
+
+c_complex_object: c_complex_object_head SYM_MATCHES SYM_START_CBLOCK c_complex_object_body SYM_END_CBLOCK
+
+c_complex_object_head: c_complex_object_id c_occurrences
+
+c_complex_object_id: type_identifier
+  | type_identifier V_LOCAL_TERM_CODE_REF
+
+c_complex_object_body: c_any #-- used to indicate that any value of a type is ok
+  | c_attributes
+
+
+#------------------------- node types -----------------------
+
+c_object: c_complex_object
+  | archetype_internal_ref
+  | archetype_slot
+  | constraint_ref
+  | c_code_phrase
+  | c_ordinal
+  | c_primitive_object
+  | v_c_domain_type
+#  | V_C_DOMAIN_TYPE
+  | ERR_C_DOMAIN_TYPE
+  | error
+
+
+# 'archetype_internal_ref' is a node that refers to a previously defined object node in the same archetype.
+archetype_internal_ref: SYM_USE_NODE type_identifier c_occurrences absolute_path
+  | SYM_USE_NODE type_identifier error
+
+# 'archetype_slot' is a node whose statements define a constraint that determines which other archetypes may appear at that point in the current archetype.
+archetype_slot: c_archetype_slot_head SYM_MATCHES SYM_START_CBLOCK c_includes c_excludes SYM_END_CBLOCK
+
+c_archetype_slot_head: c_archetype_slot_id c_occurrences
+
+c_archetype_slot_id: SYM_ALLOW_ARCHETYPE type_identifier
+  | SYM_ALLOW_ARCHETYPE type_identifier V_LOCAL_TERM_CODE_REF
+  | SYM_ALLOW_ARCHETYPE error
+
+# 'c_primitive_object' is an node representing a constraint on a primitive object type.
+c_primitive_object: c_primitive
+
+c_primitive: c_integer
+  | c_real
+  | c_date
+  | c_time
+  | c_date_time
+  | c_duration
+  | c_string
+  | c_boolean
+
+c_any: Star_code
+#c_any: '*'
+
+#---------------- BODY - relationships ----------------
+
+c_attributes: c_attribute
+  | c_attributes c_attribute
+
+# 'c_attribute' is a node representing a constraint on an attribute in an object model.
+c_attribute: c_attr_head SYM_MATCHES SYM_START_CBLOCK c_attr_values SYM_END_CBLOCK
+  | c_attr_head SYM_MATCHES SYM_START_CBLOCK error SYM_END_CBLOCK
+
+
+c_attr_head: V_ATTRIBUTE_IDENTIFIER c_existence
+  | V_ATTRIBUTE_IDENTIFIER c_existence c_cardinality
+
+c_attr_values: c_object
+  | c_attr_values c_object
+  | c_any #	-- to allow a property to have any value
+
+c_includes: #-- Empty
+    | SYM_INCLUDE assertions
+
+c_excludes: #-- Empty
+    | SYM_EXCLUDE assertions
+
+
+#---------------------- ASSERTIONS ------------------------
+
+assertions: assertion
+  | assertions assertion
+
+assertion: any_identifier ':' boolean_expression
+  | boolean_expression
+#  | any_identifier ':' error
+
+#---------------------- expressions ---------------------
+
+boolean_expression: boolean_leaf
+  | boolean_node
+
+boolean_node: SYM_EXISTS absolute_path
+#  | SYM_EXISTS error
+  | relative_path SYM_MATCHES SYM_START_CBLOCK c_primitive SYM_END_CBLOCK
+  | SYM_NOT boolean_leaf
+  | arithmetic_expression '=' arithmetic_expression
+  | arithmetic_expression SYM_NE arithmetic_expression
+  | arithmetic_expression SYM_LT arithmetic_expression
+  | arithmetic_expression SYM_GT arithmetic_expression
+  | arithmetic_expression SYM_LE arithmetic_expression
+  | arithmetic_expression SYM_GE arithmetic_expression
+  | boolean_expression SYM_AND boolean_expression
+  | boolean_expression SYM_OR boolean_expression
+  | boolean_expression SYM_XOR boolean_expression
+  | boolean_expression SYM_IMPLIES boolean_expression
+
+boolean_leaf: Left_parenthesis_code boolean_expression Right_parenthesis_code
+  | SYM_TRUE
+  | SYM_FALSE
+
+arithmetic_expression: arithmetic_leaf
+  | arithmetic_node
+
+arithmetic_node: arithmetic_expression '+' arithmetic_leaf
+  | arithmetic_expression '-' arithmetic_leaf
+  | arithmetic_expression Star_code arithmetic_leaf
+  | arithmetic_expression Slash_code arithmetic_leaf
+  | arithmetic_expression '^' arithmetic_leaf
+
+arithmetic_leaf:  Left_parenthesis_code arithmetic_expression Right_parenthesis_code
+  | integer_value
+  | real_value
+  | absolute_path
+
+
+#--------------- THE FOLLOWING SOURCE TAKEN FROM OG_PATH_VALIDATOR.Y - DO NOT MODIFY  -------------
+#--------------- except to remove movable_path ----------------------------------------------------
+
+absolute_path: Slash_code
+  | Slash_code relative_path
+  | absolute_path Slash_code relative_path
+
+relative_path: path_segment
+  | relative_path Slash_code path_segment
+
+path_segment: V_ATTRIBUTE_IDENTIFIER V_LOCAL_TERM_CODE_REF
+  | V_ATTRIBUTE_IDENTIFIER
+
+
+#-------------------------------- END SOURCE TAKEN FROM OG_PATH_VALIDATOR.Y ----------------------
+
+
+#---------------- existence, occurrences, cardinality ----------------
+
+c_existence: #-- default to 1..1
+    | SYM_EXISTENCE SYM_MATCHES SYM_START_CBLOCK existence_spec SYM_END_CBLOCK
+
+existence_spec:  V_INTEGER #-- can only be 0 or 1
+  | V_INTEGER SYM_ELLIPSIS V_INTEGER #-- can only be 0..0, 0..1, 1..1
+
+c_cardinality: SYM_CARDINALITY SYM_MATCHES SYM_START_CBLOCK cardinality_spec SYM_END_CBLOCK
+
+cardinality_spec: occurrence_spec
+  | occurrence_spec Semicolon_code SYM_ORDERED
+  | occurrence_spec Semicolon_code SYM_UNORDERED
+  | occurrence_spec Semicolon_code SYM_UNIQUE
+  | occurrence_spec Semicolon_code SYM_ORDERED Semicolon_code SYM_UNIQUE
+  | occurrence_spec Semicolon_code SYM_UNORDERED Semicolon_code SYM_UNIQUE
+  | occurrence_spec Semicolon_code SYM_UNIQUE Semicolon_code SYM_ORDERED
+  | occurrence_spec Semicolon_code SYM_UNIQUE Semicolon_code SYM_UNORDERED
+
+cardinality_limit_value: integer_value
+  | Star_code
+#  | '*'
+
+c_occurrences:  #-- default to 1..1
+  | SYM_OCCURRENCES SYM_MATCHES SYM_START_CBLOCK occurrence_spec SYM_END_CBLOCK
+#  | SYM_OCCURRENCES error
+
+occurrence_spec: cardinality_limit_value #-- single integer or '*'
+  | V_INTEGER SYM_ELLIPSIS cardinality_limit_value
+
+#---------------------- leaf constraint types -----------------------
+
+c_integer_spec: integer_value
+  | integer_list_value
+  | integer_interval_value
+
+c_integer: c_integer_spec
+  | c_integer_spec Semicolon_code integer_value
+  | c_integer_spec Semicolon_code error
+
+c_real_spec: real_value
+  | real_list_value
+  | real_interval_value
+
+c_real: c_real_spec
+  | c_real_spec Semicolon_code real_value
+  | c_real_spec Semicolon_code error
+
+c_date_constraint: V_ISO8601_DATE_CONSTRAINT_PATTERN
+  | date_value
+  | date_interval_value
+
+c_date: c_date_constraint
+  | c_date_constraint Semicolon_code date_value
+  | c_date_constraint Semicolon_code error
+
+c_time_constraint: V_ISO8601_TIME_CONSTRAINT_PATTERN
+  | time_value
+  | time_interval_value
+
+c_time: c_time_constraint
+  | c_time_constraint Semicolon_code time_value
+  | c_time_constraint Semicolon_code error
+
+c_date_time_constraint: V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN
+  | date_time_value
+  | date_time_interval_value
+
+c_date_time: c_date_time_constraint
+  | c_date_time_constraint Semicolon_code date_time_value
+  | c_date_time_constraint Semicolon_code error
+
+c_duration_constraint: duration_pattern
+  | duration_pattern Slash_code duration_interval_value
+  | duration_value
+  | duration_interval_value
+
+c_duration: c_duration_constraint
+  | c_duration_constraint Semicolon_code duration_value
+  | c_duration_constraint Semicolon_code error
+
+c_string_spec:  V_STRING #-- single value, generates closed list
+  | string_list_value #-- closed list
+  | string_list_value ',' SYM_LIST_CONTINUE #-- open list
+  | V_REGEXP #-- regular expression with "//" or "^^" delimiters
+
+c_string: c_string_spec
+  | c_string_spec Semicolon_code string_value
+#  | c_string_spec Semicolon_code error
+
+c_boolean_spec: SYM_TRUE
+  | SYM_FALSE
+  | SYM_TRUE ',' SYM_FALSE
+  | SYM_FALSE ',' SYM_TRUE
+
+c_boolean: c_boolean_spec
+  | c_boolean_spec Semicolon_code boolean_value
+#  | c_boolean_spec ';' error
+
+c_ordinal: c_ordinal_spec
+  | c_ordinal_spec Semicolon_code integer_value
+#  | c_ordinal_spec ';' error
+
+c_ordinal_spec: ordinal
+  | c_ordinal_spec ',' ordinal
+
+ordinal: integer_value SYM_INTERVAL_DELIM V_QUALIFIED_TERM_CODE_REF
+
+c_code_phrase: V_TERM_CODE_CONSTRAINT #-- e.g. "[local::at0040, at0041; at0040]"
+  | V_QUALIFIED_TERM_CODE_REF
+
+# A Constraint_Ref is a proxy for a set of constraints on an object.
+constraint_ref: V_LOCAL_TERM_CODE_REF #-- e.g. "ac0003"
+
+any_identifier: type_identifier
+  | V_ATTRIBUTE_IDENTIFIER
+
+
+#----------------- TAKEN FROM DADL_VALIDATOR.Y -------------------
+#-----------------        DO NOT MODIFY        -------------------
+#---------------------- BASIC DATA VALUES -----------------------
+
+type_identifier: V_TYPE_IDENTIFIER
+  | V_GENERIC_TYPE_IDENTIFIER
+
+string_value: V_STRING
+
+string_list_value: V_STRING ',' V_STRING
+  | string_list_value ',' V_STRING
+  | V_STRING ',' SYM_LIST_CONTINUE
+
+integer_value: V_INTEGER
+  | '+' V_INTEGER
+  | '-' V_INTEGER
+
+integer_list_value: integer_value ',' integer_value
+  | integer_list_value ',' integer_value
+  | integer_value ',' SYM_LIST_CONTINUE
+
+integer_interval_value: SYM_INTERVAL_DELIM integer_value SYM_ELLIPSIS integer_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT integer_value SYM_ELLIPSIS integer_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM integer_value SYM_ELLIPSIS SYM_LT integer_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT integer_value SYM_ELLIPSIS SYM_LT integer_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_LT integer_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_LE integer_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT integer_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GE integer_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM integer_value SYM_INTERVAL_DELIM
+
+real_value: V_REAL
+  | '+' V_REAL
+  | '-' V_REAL
+
+real_list_value: real_value ',' real_value
+  | real_list_value ',' real_value
+  | real_value ',' SYM_LIST_CONTINUE
+
+real_interval_value: SYM_INTERVAL_DELIM real_value SYM_ELLIPSIS real_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT real_value SYM_ELLIPSIS real_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM real_value SYM_ELLIPSIS SYM_LT real_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT real_value SYM_ELLIPSIS SYM_LT real_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_LT real_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_LE real_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT real_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GE real_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM real_value SYM_INTERVAL_DELIM
+
+boolean_value: SYM_TRUE
+  | SYM_FALSE
+
+boolean_list_value: boolean_value ',' boolean_value
+  | boolean_list_value ',' boolean_value
+  | boolean_value ',' SYM_LIST_CONTINUE
+
+character_value: V_CHARACTER
+
+character_list_value: character_value ',' character_value
+  | character_list_value ',' character_value
+  | character_value ',' SYM_LIST_CONTINUE
+
+date_value: V_ISO8601_EXTENDED_DATE #-- in ISO8601 form yyyy-MM-dd
+
+date_list_value: date_value ',' date_value
+  | date_list_value ',' date_value
+  | date_value ',' SYM_LIST_CONTINUE
+
+date_interval_value: SYM_INTERVAL_DELIM date_value SYM_ELLIPSIS date_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT date_value SYM_ELLIPSIS date_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM date_value SYM_ELLIPSIS SYM_LT date_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT date_value SYM_ELLIPSIS SYM_LT date_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_LT date_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_LE date_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT date_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GE date_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM date_value SYM_INTERVAL_DELIM
+
+time_value: V_ISO8601_EXTENDED_TIME
+
+time_list_value: time_value ',' time_value
+  | time_list_value ',' time_value
+  | time_value ',' SYM_LIST_CONTINUE
+
+time_interval_value: SYM_INTERVAL_DELIM time_value SYM_ELLIPSIS time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT time_value SYM_ELLIPSIS time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM time_value SYM_ELLIPSIS SYM_LT time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT time_value SYM_ELLIPSIS SYM_LT time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_LT time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_LE time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GE time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM time_value SYM_INTERVAL_DELIM
+
+date_time_value: V_ISO8601_EXTENDED_DATE_TIME
+
+date_time_list_value: date_time_value ',' date_time_value
+  | date_time_list_value ',' date_time_value
+  | date_time_value ',' SYM_LIST_CONTINUE
+
+date_time_interval_value: SYM_INTERVAL_DELIM date_time_value SYM_ELLIPSIS date_time_value  SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT date_time_value SYM_ELLIPSIS date_time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM date_time_value SYM_ELLIPSIS SYM_LT date_time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT date_time_value SYM_ELLIPSIS SYM_LT date_time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_LT date_time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_LE date_time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT date_time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GE date_time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM date_time_value SYM_INTERVAL_DELIM
+
+duration_pattern: V_ISO8601_DURATION_CONSTRAINT_PATTERN
+
+duration_value: V_ISO8601_DURATION
+
+duration_list_value: duration_value ',' duration_value
+  | duration_list_value ',' duration_value
+  | duration_value ',' SYM_LIST_CONTINUE
+
+duration_interval_value: SYM_INTERVAL_DELIM duration_value SYM_ELLIPSIS duration_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT duration_value SYM_ELLIPSIS duration_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM duration_value SYM_ELLIPSIS SYM_LT duration_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT duration_value SYM_ELLIPSIS SYM_LT duration_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_LT duration_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_LE duration_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT duration_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GE duration_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM duration_value SYM_INTERVAL_DELIM
+
+term_code: V_QUALIFIED_TERM_CODE_REF
+  | ERR_V_QUALIFIED_TERM_CODE_REF
+
+term_code_list_value: term_code ',' term_code
+  | term_code_list_value ',' term_code
+  | term_code ',' SYM_LIST_CONTINUE
+
+uri_value: V_URI
+
+
+---- header
+
+$:.unshift File.join(File.dirname(__FILE__))
+$DEBUG = false
+
+
+---- inner
+###----------/* keywords */ --------------------------------------------- 
+@@reserved = {
+  'then' => :SYM_THEN,
+  'else' => :SYM_ELSE,
+  'and' => :SYM_AND,
+  'or' => :SYM_OR,
+  'xor' => :SYM_XOR,
+  'not' => :SYM_NOT,
+  'implies' => :SYM_IMPLIES,
+  'true' => :SYM_TRUE, #[Tt][Rr][Uu][Ee] -- -> SYM_TRUE 
+  'false' => :SYM_FALSE, # [Ff][Aa][Ll][Ss][Ee] -- -> SYM_FALSE 
+  'forall' => :SYM_FORALL,
+  'exists' => :SYM_EXISTS,
+  'existence' => :SYM_EXISTENCE,
+  'occurrences' => :SYM_OCCURRENCES,
+  'cardinality' => :SYM_CARDINALITY,
+  'ordered' => :SYM_ORDERED,
+  'unordered' => :SYM_UNORDERED,
+  'unique' => :SYM_UNIQUE,
+  'matches' => :SYM_MATCHES,
+  'is_in' => :SYM_MATCHES,
+  'invariant' => :SYM_INVARIANT,
+  'infinity' => :SYM_INFINITY, # [Ii][Nn][Ff][Ii][Nn][Ii][Tt][Yy] -- -> SYM_INFINITY 
+  'use_archetype' => :SYM_ALLOW_ARCHETYPE,
+  'allow_archetype' => :SYM_ALLOW_ARCHETYPE,
+  'include' => :SYM_INCLUDE,
+  'exclude' => :SYM_EXCLUDE
+}
+
+###----------/* 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\=/   # =
+      yield :SYM_EQ, :SYM_EQ
+    when /\A\>=/   # >=
+      yield :SYM_GE, :SYM_GE
+    when /\A\<=/   # <=
+      yield :SYM_LE, :SYM_LE
+    when /\A\</   # <
+      yield :SYM_LT, :SYM_LT
+    when /\A\>/   # >
+      yield :SYM_GT, :SYM_GT
+    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 :SYM_ELLIPSIS, :SYM_ELLIPSIS
+    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 :SYM_START_CBLOCK, :SYM_START_CBLOCK
+    when /\A\}/   # {
+      yield :SYM_END_CBLOCK, :SYM_END_CBLOCK
+    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\|/   # |
+      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\[[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 /\A\[([a-zA-Z0-9()._\-]+::[a-zA-Z0-9._\_-]+)\]/
+      yield :V_TERM_CODE_CONSTRAINT, :V_TERM_CODE_CONSTRAINT
+    when /\A\[[a-zA-Z0-9][a-zA-Z0-9._\-]*\]/   #V_LOCAL_TERM_CODE_REF
+      yield :V_LOCAL_TERM_CODE_REF, $&
+    when /\A\[/   # [
+      yield :Left_bracket_code, :Left_bracket_code
+    when /\A\]/   # ]
+      yield :Right_bracket_code, :Right_bracket_code
+    when /\A\.../   # ...
+      yield :SYM_LIST_CONTINUE, :SYM_LIST_CONTINUE
+    when /\A[a-z][a-zA-Z0-9_]*/
+      word = $&.downcase
+      if @@reserved[word]
+        yield @@reserved[word], @@reserved[word]
+      else #V_ATTRIBUTE_IDENTIFIER /\A[a-z][a-zA-Z0-9_]*/ 
+        yield :V_ATTRIBUTE_IDENTIFIER, $&
+      end
+    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[yY][yY][yY][yY]-[mM?X][mM?X]-[dD?X][dD?X]/
+      yield :V_ISO8601_DATE_CONSTRAINT_PATTERN, $&
+    when /\A[hH][hH]:[mM?X][mM?X]:[sS?X][sS?X]/
+      yield :V_ISO8601_TIME_CONSTRAINT_PATTERN, $&
+    when /\A[yY][yY][yY][yY]-[mM?X][mM?X]-[dD?X][dD?X][\t][hH?X][hH?X]:[mM?X][mM?X]:[sS?X][sS?X]/
+      yield :V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN, $&
+    when /\A[A-Z][a-zA-Z0-9_]*/
+      yield :V_TYPE_IDENTIFIER, $&
+    when /\A[a-z][a-zA-Z0-9_]*/
+      yield :V_ATTRIBUTE_IDENTIFIER, $&
+    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
+###     when /\A{\// #V_REGEXP
+###       if @in_regexp
+###         @in_regexp = false
+###       elsif @start_block_received
+###         @in_interval = true
+###         @start_block_received = false
+###       end
+###       yield :V_REGEXP, :V_REGEXP
+    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 
+# <IN_CADL_BLOCK>\{[^{}]* -- got an open brace 
+# <IN_CADL_BLOCK>[^{}]*\} -- got a close brace 
+
+
+
+
+
+
+### Local Variables:
+### mode:ruby
+### mode:font-lock
+### comment-column:0
+### comment-start: "### "
+### comment-end:"" 
+### End:
+
+
+
+
Index: by/trunk/adl_parser/lib/dparser.y
===================================================================
--- /ruby/trunk/adl_parser/lib/dparser.y	(revision 16)
+++ 	(revision )
@@ -1,413 +1,0 @@
-
-
-class OpenEHR::DADLParser
-
-#options omit_action_call
-
-prechigh
-
-  nonassoc UMINUS UPLUS
-  left '*' '/'
-  left '+' '-'
-
-#  left DOUBLE_BAR
-
-  nonassoc SYM_EQ
-  nonassoc SYM_NE
-  nonassoc SYM_LT
-  nonassoc SYM_START_DBLOCK
-  nonassoc SYM_GT
-  nonassoc SYM_END_DBLOCK
-  nonassoc SYM_LE
-  nonassoc SYM_GE
-
-preclow
-
-
-rule
-### http://svn.openehr.org/ref_impl_eiffel/TRUNK/libraries/common_libs/src/structures/syntax/dadl/parser/dadl2_validator.html
-
-dadl: input EOF
-input: attr_vals
-  | complex_object_block
-#  | error
-attr_vals: attr_val
-  | attr_vals attr_val
-  | attr_vals ';' attr_val
-attr_val: attr_id SYM_EQ object_block
-attr_id: V_ATTRIBUTE_IDENTIFIER
-#  | V_ATTRIBUTE_IDENTIFIER error
-object_block: complex_object_block
-  | primitive_object_block
-complex_object_block: single_attr_object_block
-  | multiple_attr_object_block
-multiple_attr_object_block: untyped_multiple_attr_object_block
-  | type_identifier untyped_multiple_attr_object_block
-untyped_multiple_attr_object_block: multiple_attr_object_block_head keyed_objects SYM_END_DBLOCK
-multiple_attr_object_block_head: SYM_START_DBLOCK
-keyed_objects: keyed_object
-  | keyed_objects keyed_object
-keyed_object: object_key SYM_EQ object_block
-object_key: Left_bracket_code simple_value Right_bracket_code
-
-single_attr_object_block: untyped_single_attr_object_block
-  | type_identifier untyped_single_attr_object_block
-untyped_single_attr_object_block: single_attr_object_complex_head SYM_END_DBLOCK
-  | single_attr_object_complex_head attr_vals SYM_END_DBLOCK
-single_attr_object_complex_head: SYM_START_DBLOCK
-primitive_object_block: untyped_primitive_object_block
-  | type_identifier untyped_primitive_object_block
-untyped_primitive_object_block: SYM_START_DBLOCK primitive_object_value SYM_END_DBLOCK
-primitive_object_value: simple_value
-  | simple_list_value
-  | simple_interval_value
-  | term_code
-  | term_code_list_value
-simple_value: string_value
-  | integer_value
-  | real_value
-  | boolean_value
-  | character_value
-  | date_value
-  | time_value
-  | date_time_value
-  | duration_value
-  | uri_value
-simple_list_value: string_list_value
-  | integer_list_value
-  | real_list_value
-  | boolean_list_value
-  | character_list_value
-  | date_list_value
-  | time_list_value
-  | date_time_list_value
-  | duration_list_value
-
-simple_interval_value: integer_interval_value
-  | real_interval_value
-  | date_interval_value
-  | time_interval_value
-  | date_time_interval_value
-  | duration_interval_value
-
-type_identifier: V_TYPE_IDENTIFIER
-  | V_GENERIC_TYPE_IDENTIFIER
-
-string_value: V_STRING
-
-string_list_value: V_STRING Comma_code V_STRING
-  | string_list_value Comma_code V_STRING
-  | V_STRING Comma_code SYM_LIST_CONTINUE
-integer_value: V_INTEGER
-  | '+' V_INTEGER
-  | '-' V_INTEGER 
-integer_list_value: integer_value Comma_code integer_value
-  | integer_list_value Comma_code integer_value
-  | integer_value Comma_code SYM_LIST_CONTINUE
-
-integer_interval_value: SYM_INTERVAL_DELIM integer_value SYM_ELLIPSIS integer_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT integer_value SYM_ELLIPSIS integer_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM integer_value SYM_ELLIPSIS SYM_LT integer_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT integer_value SYM_ELLIPSIS SYM_LT integer_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_LT integer_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_LE integer_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT integer_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GE integer_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM integer_value SYM_INTERVAL_DELIM
-
-real_value: V_REAL
-  | '+' V_REAL
-  | '-' V_REAL
-
-real_list_value: real_value Comma_code real_value
-  | real_list_value Comma_code real_value
-  | real_value Comma_code SYM_LIST_CONTINUE
-
-real_interval_value: SYM_INTERVAL_DELIM real_value SYM_ELLIPSIS real_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT real_value SYM_ELLIPSIS real_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM real_value SYM_ELLIPSIS SYM_LT real_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT real_value SYM_ELLIPSIS SYM_LT real_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_LT real_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_LE real_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT real_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GE real_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM real_value SYM_INTERVAL_DELIM
-
-
-boolean_value: SYM_TRUE
-  | SYM_FALSE
-
-boolean_list_value: boolean_value Comma_code boolean_value
-  | boolean_list_value Comma_code boolean_value
-  | boolean_value Comma_code SYM_LIST_CONTINUE
-
-character_value: V_CHARACTER
-
-character_list_value: character_value Comma_code character_value
-  | character_list_value Comma_code character_value
-  | character_value Comma_code SYM_LIST_CONTINUE
-
-date_value: V_ISO8601_EXTENDED_DATE
-
-date_list_value: date_value Comma_code date_value
-  | date_list_value Comma_code date_value
-  | date_value Comma_code SYM_LIST_CONTINUE
-
-date_interval_value: SYM_INTERVAL_DELIM date_value SYM_ELLIPSIS date_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT date_value SYM_ELLIPSIS date_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM date_value SYM_ELLIPSIS SYM_LT date_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT date_value SYM_ELLIPSIS SYM_LT date_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_LT date_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_LE date_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT date_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GE date_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM date_value SYM_INTERVAL_DELIM
-
-time_value: V_ISO8601_EXTENDED_TIME
-time_list_value: time_value Comma_code time_value
-  | time_list_value Comma_code time_value
-  | time_value Comma_code SYM_LIST_CONTINUE
-
-time_interval_value: SYM_INTERVAL_DELIM time_value SYM_ELLIPSIS time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT time_value SYM_ELLIPSIS time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM time_value SYM_ELLIPSIS SYM_LT time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT time_value SYM_ELLIPSIS SYM_LT time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_LT time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_LE time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GE time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM time_value SYM_INTERVAL_DELIM
-
-date_time_value: V_ISO8601_EXTENDED_DATE_TIME
-
-date_time_list_value: date_time_value Comma_code date_time_value
-  | date_time_list_value Comma_code date_time_value
-  | date_time_value Comma_code SYM_LIST_CONTINUE
-
-date_time_interval_value: SYM_INTERVAL_DELIM date_time_value SYM_ELLIPSIS date_time_value  SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT date_time_value SYM_ELLIPSIS date_time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM date_time_value SYM_ELLIPSIS SYM_LT date_time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT date_time_value SYM_ELLIPSIS SYM_LT date_time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_LT date_time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_LE date_time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT date_time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GE date_time_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM date_time_value SYM_INTERVAL_DELIM
-
-duration_value: V_ISO8601_DURATION
-
-duration_list_value: duration_value Comma_code duration_value
-  | duration_list_value Comma_code duration_value
-  | duration_value Comma_code SYM_LIST_CONTINUE
-
-duration_interval_value: SYM_INTERVAL_DELIM duration_value SYM_ELLIPSIS duration_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT duration_value SYM_ELLIPSIS duration_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM duration_value SYM_ELLIPSIS SYM_LT duration_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT duration_value SYM_ELLIPSIS SYM_LT duration_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_LT duration_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_LE duration_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GT duration_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM SYM_GE duration_value SYM_INTERVAL_DELIM
-  | SYM_INTERVAL_DELIM duration_value SYM_INTERVAL_DELIM
-
-term_code: V_QUALIFIED_TERM_CODE_REF
-
-term_code_list_value: term_code Comma_code term_code
-  | term_code_list_value Comma_code term_code
-  | term_code Comma_code SYM_LIST_CONTINUE
-
-uri_value: V_URI
-
----- header
-
-$:.unshift File.join(File.dirname(__FILE__))
-$DEBUG = false
-
-
----- inner
-###----------/* keywords */ --------------------------------------------- 
-@@reserved = {
-  '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\=/   # =
-      yield :SYM_EQ, :SYM_EQ
-    when /\A\>\=/   # >=
-      yield :SYM_GE, :SYM_GE
-    when /\A\<\=/   # <=
-      yield :SYM_LE, :SYM_LE
-    when /\A\</   # <
-      if @in_interval
-        @start_block_received = false
-        yield :SYM_LT, :SYM_LT
-      else
-        @start_block_received = true
-        yield :SYM_START_DBLOCK, :SYM_START_DBLOCK
-      end
-    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 :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\|/   # |
-      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-Z][a-zA-Z0-9_]*<[a-zA-Z0-9,_<>]+>/   #V_GENERIC_TYPE_IDENTIFIER
-      yield :V_GENERIC_TYPE_IDENTIFIER, $&
-    when /\A[a-z][a-zA-Z0-9_]*/
-      word = $&.downcase
-      if @@reserved[word]
-        yield @@reserved[word], @@reserved[word]
-      else
-        yield :V_ATTRIBUTE_IDENTIFIER, $&
-      end
-    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 /\A\[[a-zA-Z0-9][a-zA-Z0-9._\-]*\]/   #V_LOCAL_TERM_CODE_REF
-      yield :V_LOCAL_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_]*<[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 
-# <IN_STR> { 
-# \\\\ -- 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 | 
-# <<EOF>> -- unclosed String -> ERR_STRING 
-# }
-# ###----------/* V_CHARACTER */ -------------------------------------------- 
-# \'{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 
-# <IN_CADL_BLOCK>\{[^{}]* -- got an open brace 
-# <IN_CADL_BLOCK>[^{}]*\} -- got a close brace 
-
-
-
-
-
-
-### Local Variables:
-### mode:ruby
-### mode:font-lock
-### comment-column:0
-### comment-start: "### "
-### comment-end:"" 
-### End:
-
-
-
-
Index: /ruby/trunk/adl_parser/lib/dparser.y.bak
===================================================================
--- /ruby/trunk/adl_parser/lib/dparser.y.bak	(revision 17)
+++ /ruby/trunk/adl_parser/lib/dparser.y.bak	(revision 17)
@@ -0,0 +1,413 @@
+
+
+class OpenEHR::DADLParser
+
+#options omit_action_call
+
+prechigh
+
+  nonassoc UMINUS UPLUS
+  left '*' '/'
+  left '+' '-'
+
+#  left DOUBLE_BAR
+
+  nonassoc SYM_EQ
+  nonassoc SYM_NE
+  nonassoc SYM_LT
+  nonassoc SYM_START_DBLOCK
+  nonassoc SYM_GT
+  nonassoc SYM_END_DBLOCK
+  nonassoc SYM_LE
+  nonassoc SYM_GE
+
+preclow
+
+
+rule
+### http://svn.openehr.org/ref_impl_eiffel/TRUNK/libraries/common_libs/src/structures/syntax/dadl/parser/dadl2_validator.html
+
+dadl: input EOF
+input: attr_vals
+  | complex_object_block
+#  | error
+attr_vals: attr_val
+  | attr_vals attr_val
+  | attr_vals ';' attr_val
+attr_val: attr_id SYM_EQ object_block
+attr_id: V_ATTRIBUTE_IDENTIFIER
+#  | V_ATTRIBUTE_IDENTIFIER error
+object_block: complex_object_block
+  | primitive_object_block
+complex_object_block: single_attr_object_block
+  | multiple_attr_object_block
+multiple_attr_object_block: untyped_multiple_attr_object_block
+  | type_identifier untyped_multiple_attr_object_block
+untyped_multiple_attr_object_block: multiple_attr_object_block_head keyed_objects SYM_END_DBLOCK
+multiple_attr_object_block_head: SYM_START_DBLOCK
+keyed_objects: keyed_object
+  | keyed_objects keyed_object
+keyed_object: object_key SYM_EQ object_block
+object_key: Left_bracket_code simple_value Right_bracket_code
+
+single_attr_object_block: untyped_single_attr_object_block
+  | type_identifier untyped_single_attr_object_block
+untyped_single_attr_object_block: single_attr_object_complex_head SYM_END_DBLOCK
+  | single_attr_object_complex_head attr_vals SYM_END_DBLOCK
+single_attr_object_complex_head: SYM_START_DBLOCK
+primitive_object_block: untyped_primitive_object_block
+  | type_identifier untyped_primitive_object_block
+untyped_primitive_object_block: SYM_START_DBLOCK primitive_object_value SYM_END_DBLOCK
+primitive_object_value: simple_value
+  | simple_list_value
+  | simple_interval_value
+  | term_code
+  | term_code_list_value
+simple_value: string_value
+  | integer_value
+  | real_value
+  | boolean_value
+  | character_value
+  | date_value
+  | time_value
+  | date_time_value
+  | duration_value
+  | uri_value
+simple_list_value: string_list_value
+  | integer_list_value
+  | real_list_value
+  | boolean_list_value
+  | character_list_value
+  | date_list_value
+  | time_list_value
+  | date_time_list_value
+  | duration_list_value
+
+simple_interval_value: integer_interval_value
+  | real_interval_value
+  | date_interval_value
+  | time_interval_value
+  | date_time_interval_value
+  | duration_interval_value
+
+type_identifier: V_TYPE_IDENTIFIER
+  | V_GENERIC_TYPE_IDENTIFIER
+
+string_value: V_STRING
+
+string_list_value: V_STRING Comma_code V_STRING
+  | string_list_value Comma_code V_STRING
+  | V_STRING Comma_code SYM_LIST_CONTINUE
+integer_value: V_INTEGER
+  | '+' V_INTEGER
+  | '-' V_INTEGER 
+integer_list_value: integer_value Comma_code integer_value
+  | integer_list_value Comma_code integer_value
+  | integer_value Comma_code SYM_LIST_CONTINUE
+
+integer_interval_value: SYM_INTERVAL_DELIM integer_value SYM_ELLIPSIS integer_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT integer_value SYM_ELLIPSIS integer_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM integer_value SYM_ELLIPSIS SYM_LT integer_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT integer_value SYM_ELLIPSIS SYM_LT integer_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_LT integer_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_LE integer_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT integer_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GE integer_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM integer_value SYM_INTERVAL_DELIM
+
+real_value: V_REAL
+  | '+' V_REAL
+  | '-' V_REAL
+
+real_list_value: real_value Comma_code real_value
+  | real_list_value Comma_code real_value
+  | real_value Comma_code SYM_LIST_CONTINUE
+
+real_interval_value: SYM_INTERVAL_DELIM real_value SYM_ELLIPSIS real_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT real_value SYM_ELLIPSIS real_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM real_value SYM_ELLIPSIS SYM_LT real_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT real_value SYM_ELLIPSIS SYM_LT real_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_LT real_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_LE real_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT real_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GE real_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM real_value SYM_INTERVAL_DELIM
+
+
+boolean_value: SYM_TRUE
+  | SYM_FALSE
+
+boolean_list_value: boolean_value Comma_code boolean_value
+  | boolean_list_value Comma_code boolean_value
+  | boolean_value Comma_code SYM_LIST_CONTINUE
+
+character_value: V_CHARACTER
+
+character_list_value: character_value Comma_code character_value
+  | character_list_value Comma_code character_value
+  | character_value Comma_code SYM_LIST_CONTINUE
+
+date_value: V_ISO8601_EXTENDED_DATE
+
+date_list_value: date_value Comma_code date_value
+  | date_list_value Comma_code date_value
+  | date_value Comma_code SYM_LIST_CONTINUE
+
+date_interval_value: SYM_INTERVAL_DELIM date_value SYM_ELLIPSIS date_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT date_value SYM_ELLIPSIS date_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM date_value SYM_ELLIPSIS SYM_LT date_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT date_value SYM_ELLIPSIS SYM_LT date_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_LT date_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_LE date_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT date_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GE date_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM date_value SYM_INTERVAL_DELIM
+
+time_value: V_ISO8601_EXTENDED_TIME
+time_list_value: time_value Comma_code time_value
+  | time_list_value Comma_code time_value
+  | time_value Comma_code SYM_LIST_CONTINUE
+
+time_interval_value: SYM_INTERVAL_DELIM time_value SYM_ELLIPSIS time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT time_value SYM_ELLIPSIS time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM time_value SYM_ELLIPSIS SYM_LT time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT time_value SYM_ELLIPSIS SYM_LT time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_LT time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_LE time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GE time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM time_value SYM_INTERVAL_DELIM
+
+date_time_value: V_ISO8601_EXTENDED_DATE_TIME
+
+date_time_list_value: date_time_value Comma_code date_time_value
+  | date_time_list_value Comma_code date_time_value
+  | date_time_value Comma_code SYM_LIST_CONTINUE
+
+date_time_interval_value: SYM_INTERVAL_DELIM date_time_value SYM_ELLIPSIS date_time_value  SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT date_time_value SYM_ELLIPSIS date_time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM date_time_value SYM_ELLIPSIS SYM_LT date_time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT date_time_value SYM_ELLIPSIS SYM_LT date_time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_LT date_time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_LE date_time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT date_time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GE date_time_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM date_time_value SYM_INTERVAL_DELIM
+
+duration_value: V_ISO8601_DURATION
+
+duration_list_value: duration_value Comma_code duration_value
+  | duration_list_value Comma_code duration_value
+  | duration_value Comma_code SYM_LIST_CONTINUE
+
+duration_interval_value: SYM_INTERVAL_DELIM duration_value SYM_ELLIPSIS duration_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT duration_value SYM_ELLIPSIS duration_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM duration_value SYM_ELLIPSIS SYM_LT duration_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT duration_value SYM_ELLIPSIS SYM_LT duration_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_LT duration_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_LE duration_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GT duration_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM SYM_GE duration_value SYM_INTERVAL_DELIM
+  | SYM_INTERVAL_DELIM duration_value SYM_INTERVAL_DELIM
+
+term_code: V_QUALIFIED_TERM_CODE_REF
+
+term_code_list_value: term_code Comma_code term_code
+  | term_code_list_value Comma_code term_code
+  | term_code Comma_code SYM_LIST_CONTINUE
+
+uri_value: V_URI
+
+---- header
+
+$:.unshift File.join(File.dirname(__FILE__))
+$DEBUG = false
+
+
+---- inner
+###----------/* keywords */ --------------------------------------------- 
+@@reserved = {
+  '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\=/   # =
+      yield :SYM_EQ, :SYM_EQ
+    when /\A\>\=/   # >=
+      yield :SYM_GE, :SYM_GE
+    when /\A\<\=/   # <=
+      yield :SYM_LE, :SYM_LE
+    when /\A\</   # <
+      if @in_interval
+        @start_block_received = false
+        yield :SYM_LT, :SYM_LT
+      else
+        @start_block_received = true
+        yield :SYM_START_DBLOCK, :SYM_START_DBLOCK
+      end
+    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 :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\|/   # |
+      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-Z][a-zA-Z0-9_]*<[a-zA-Z0-9,_<>]+>/   #V_GENERIC_TYPE_IDENTIFIER
+      yield :V_GENERIC_TYPE_IDENTIFIER, $&
+    when /\A[a-z][a-zA-Z0-9_]*/
+      word = $&.downcase
+      if @@reserved[word]
+        yield @@reserved[word], @@reserved[word]
+      else
+        yield :V_ATTRIBUTE_IDENTIFIER, $&
+      end
+    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 /\A\[[a-zA-Z0-9][a-zA-Z0-9._\-]*\]/   #V_LOCAL_TERM_CODE_REF
+      yield :V_LOCAL_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_]*<[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 
+# <IN_STR> { 
+# \\\\ -- 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 | 
+# <<EOF>> -- unclosed String -> ERR_STRING 
+# }
+# ###----------/* V_CHARACTER */ -------------------------------------------- 
+# \'{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 
+# <IN_CADL_BLOCK>\{[^{}]* -- got an open brace 
+# <IN_CADL_BLOCK>[^{}]*\} -- got a close brace 
+
+
+
+
+
+
+### Local Variables:
+### mode:ruby
+### mode:font-lock
+### comment-column:0
+### comment-start: "### "
+### comment-end:"" 
+### End:
+
+
+
+
Index: /ruby/trunk/adl_parser/lib/parser.rb
===================================================================
--- /ruby/trunk/adl_parser/lib/parser.rb	(revision 16)
+++ /ruby/trunk/adl_parser/lib/parser.rb	(revision 17)
@@ -10,9 +10,12 @@
 
 $:.unshift File.join(File.dirname(__FILE__))
+require 'logger'
 require 'lib/util.rb'
+require 'lib/scanner.rb'
 $DEBUG = true
 
 
 
+
 module OpenEHR
 
@@ -21,5 +24,9 @@
     class Parser < Racc::Parser
 
-module_eval <<'..end lib/parser.y modeval..id35ef94ed29', 'lib/parser.y', 642
+module_eval <<'..end lib/parser.y modeval..idbb16065644', 'lib/parser.y', 644
+
+@@log = Logger.new('log/parser.log')
+@@dadl_scanner = OpenEHR::ADL::Scanner::DADL::RootScanner.new
+
 ###----------/* keywords */ --------------------------------------------- 
 @@adl_reserved = {
@@ -478,4 +485,16 @@
     when :dadl
 #      puts "Entering scan_dadl"
+      case scanned = @@dadl_scanner.parse(data)
+      when Yaparc::Result::OK
+        yield scanned.value
+        data = scanned.input
+###       when Yaparc::Result::Fail
+###         raise "Scan Failed: #{scanned}"
+###       when Yaparc::Result::Error
+###         raise "Scan Error: #{scanned}"
+      else
+        
+      end
+
       case data
       when /\A\n/ # carriage return
@@ -566,10 +585,10 @@
         end
         yield :SYM_INTERVAL_DELIM, :SYM_INTERVAL_DELIM
-      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\._-]+\]/   #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._\-]*\]/   #V_LOCAL_TERM_CODE_REF
+###         yield :V_LOCAL_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 /\A\[[a-zA-Z0-9][a-zA-Z0-9._\-]*\]/   #V_LOCAL_TERM_CODE_REF
-        yield :V_LOCAL_TERM_CODE_REF, $&
       when /\A\[/   # [
         yield :Left_bracket_code, :Left_bracket_code
@@ -774,5 +793,5 @@
 
 
-..end lib/parser.y modeval..id35ef94ed29
+..end lib/parser.y modeval..idbb16065644
 
 ##### racc 1.4.5 generates ###
@@ -2010,5 +2029,5 @@
  # reduce 18 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 74
+module_eval <<'.,.,', 'lib/parser.y', 73
   def _reduce_19( val, _values, result )
     result = {:language => val[1]}
@@ -2039,5 +2058,5 @@
  # reduce 30 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 111
+module_eval <<'.,.,', 'lib/parser.y', 110
   def _reduce_31( val, _values, result )
     result = {:c_complex_object_id => {:type_identifier => val[0]}}
@@ -2046,5 +2065,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 115
+module_eval <<'.,.,', 'lib/parser.y', 114
   def _reduce_32( val, _values, result )
     result = {:c_complex_object_id => {:type_identifier => val[0], :V_LOCAL_TERM_CODE_REF => val[1]}}
Index: /ruby/trunk/adl_parser/lib/parser.y
===================================================================
--- /ruby/trunk/adl_parser/lib/parser.y	(revision 16)
+++ /ruby/trunk/adl_parser/lib/parser.y	(revision 17)
@@ -1,3 +1,2 @@
-
 
 class OpenEHR::ADL::Parser
@@ -635,9 +634,16 @@
 
 $:.unshift File.join(File.dirname(__FILE__))
+require 'logger'
 require 'lib/util.rb'
+require 'lib/scanner.rb'
 $DEBUG = true
 
 
+
 ---- inner
+
+@@log = Logger.new('log/parser.log')
+@@dadl_scanner = OpenEHR::ADL::Scanner::DADL::RootScanner.new
+
 ###----------/* keywords */ --------------------------------------------- 
 @@adl_reserved = {
@@ -1096,4 +1102,16 @@
     when :dadl
 #      puts "Entering scan_dadl"
+      case scanned = @@dadl_scanner.parse(data)
+      when Yaparc::Result::OK
+        yield scanned.value
+        data = scanned.input
+###       when Yaparc::Result::Fail
+###         raise "Scan Failed: #{scanned}"
+###       when Yaparc::Result::Error
+###         raise "Scan Error: #{scanned}"
+      else
+        
+      end
+
       case data
       when /\A\n/ # carriage return
@@ -1184,10 +1202,10 @@
         end
         yield :SYM_INTERVAL_DELIM, :SYM_INTERVAL_DELIM
-      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\._-]+\]/   #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._\-]*\]/   #V_LOCAL_TERM_CODE_REF
+###         yield :V_LOCAL_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 /\A\[[a-zA-Z0-9][a-zA-Z0-9._\-]*\]/   #V_LOCAL_TERM_CODE_REF
-        yield :V_LOCAL_TERM_CODE_REF, $&
       when /\A\[/   # [
         yield :Left_bracket_code, :Left_bracket_code
Index: /ruby/trunk/adl_parser/lib/scanner.rb
===================================================================
--- /ruby/trunk/adl_parser/lib/scanner.rb	(revision 17)
+++ /ruby/trunk/adl_parser/lib/scanner.rb	(revision 17)
@@ -0,0 +1,61 @@
+require 'logger'
+require 'rubygems'
+require 'yaparc'
+
+
+
+module OpenEHR
+  module ADL
+    module Scanner
+      module DADL
+        # c.f. http://www.openehr.org/svn/ref_impl_eiffel/TRUNK/components/adl_parser/src/syntax/adl/parser/adl_scanner.l
+        @@dadl_reserved = {
+          '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 
+        }
+
+        LOG = Logger.new('log/scanner.log')
+
+        class RootScanner
+          include Yaparc::Parsable
+          def initialize
+            @parser = lambda do |input|
+              Yaparc::Alt.new(
+                              V_QUALIFIED_TERM_CODE_REF.new,
+                              V_LOCAL_TERM_CODE_REF.new
+                              )
+            end
+          end
+        end
+
+        class V_QUALIFIED_TERM_CODE_REF
+          include Yaparc::Parsable
+          def initialize
+            @parser = lambda do |input|
+              Yaparc::Apply.new(Yaparc::Regex.new(/\A\[[a-zA-Z0-9()\._-]+::[a-zA-Z0-9\._-]+\]/)) do |match|
+                LOG.info("V_QUALIFIED_TERM_CODE_REF: #{match}")
+                [:V_QUALIFIED_TERM_CODE_REF, match]
+              end
+            end
+          end
+        end
+
+        class V_LOCAL_TERM_CODE_REF
+          include Yaparc::Parsable
+          def initialize
+            @parser = lambda do |input|
+              Yaparc::Apply.new(Yaparc::Regex.new(/\A\[[a-zA-Z0-9][a-zA-Z0-9._\-]*\]/)) do |match|
+                LOG.info("V_TERM_CODE_REF: #{match}")
+                [:V_LOCAL_TERM_CODE_REF, match]
+              end
+            end
+          end
+        end
+      end # of DADL
+      module CADL
+        # c.f. http://www.openehr.org/svn/ref_impl_eiffel/TRUNK/components/adl_parser/src/syntax/cadl/parser/cadl_scanner.l
+      end
+    end
+  end
+end
Index: /ruby/trunk/adl_parser/tests/parser_test.rb
===================================================================
--- /ruby/trunk/adl_parser/tests/parser_test.rb	(revision 16)
+++ /ruby/trunk/adl_parser/tests/parser_test.rb	(revision 17)
@@ -96,9 +96,9 @@
       @parser.parse(imaging, 'openEHR-EHR-ACTION.imaging.v1.adl')
     end
-    apgar = File.read('tests/openEHR-EHR-OBSERVATION.apgar.v1.adl')
-#    assert_nothing_raised do
-      result = @parser.parse(apgar, 'openEHR-EHR-OBSERVATION.apgar.v1.adl')
-      assert_equal "", result
-#    end
+#     apgar = File.read('tests/openEHR-EHR-OBSERVATION.apgar.v1.adl')
+# #    assert_nothing_raised do
+#       result = @parser.parse(apgar, 'openEHR-EHR-OBSERVATION.apgar.v1.adl')
+#       assert_equal "", result
+# #    end
 #     evaluation = File.read('tests/openEHR-EHR-EVALUATION.adverse.v1.adl')
 #     assert_nothing_raised do
Index: /ruby/trunk/adl_parser/tests/scanner_test.rb
===================================================================
--- /ruby/trunk/adl_parser/tests/scanner_test.rb	(revision 17)
+++ /ruby/trunk/adl_parser/tests/scanner_test.rb	(revision 17)
@@ -0,0 +1,16 @@
+require 'lib/scanner.rb'
+require 'test/unit'
+
+class YaparcParserTest < Test::Unit::TestCase
+  def test_RootScanner
+    parser = OpenEHR::ADL::Scanner::DADL::RootScanner.new
+    assert_instance_of OpenEHR::ADL::Scanner::DADL::RootScanner,parser
+    result = parser.parse('')
+  end
+
+  def test_V_LOCAL_TERM_CODE_REF
+    parser = OpenEHR::ADL::Scanner::DADL::V_LOCAL_TERM_CODE_REF.new
+    assert_instance_of OpenEHR::ADL::Scanner::DADL::V_LOCAL_TERM_CODE_REF,parser
+    result = parser.parse('')
+  end
+end
