Working through my implementation of an Odin parser, I notice that the OdinValuesParser may have a slight issue when it comes to handling terminology codes.
The grammar contains the following line
termCodeValue : QUALIFIED_TERM_CODE_REF ;
There is no further breach down of QUALIFIED_TERM_CODE_REF within the grammar file. Looking across the other grammar files, it seems that the missing constructs are in the OpenehrPatterns grammar file.
It contains
// ADL and ODIN-style term codes uses []; e.g. [ICD10AM(1998)::F23]; [ISO_639-1::en]
// New EL style uses #xxxx
QUALIFIED_TERM_CODE_ID: '#' COMPACT_QUALIFIED_TERM_CODE ;
LOCAL_TERM_CODE_ID: '#' TERM_CODE_STRING ;
QUALIFIED_TERM_CODE_REF: '[' COMPACT_QUALIFIED_TERM_CODE ']' ;
fragment COMPACT_QUALIFIED_TERM_CODE : TERM_CODE_STRING ( '(' TERM_CODE_STRING ')' )? '::' TERM_CODE_STRING ( '|' .+? '|' )? ;
fragment TERM_CODE_STRING: TERM_CODE_CHAR+ ;
fragment TERM_CODE_CHAR : ALPHANUM_US_HYP_CHAR | '.' ;
Should this have been an import into the OdinValuesParser grammar file?
If, so could the grammar below be more descriptive?
fragment COMPACT_QUALIFIED_TERM_CODE : TERM_CODE_STRING ( '(' TERM_CODE_STRING ')' )? '::' TERM_CODE_STRING ( '|' .+? '|' )? ;
Using TERM_CODE_STRING to represent terminology_id.name, terminology_id.version_id and also code_phrase.code_string may benefit from more explicit grammar definitions.
Raised as SPECPR-416 just in case