It is also a problem when a s comment, like this:
– duration_attr28 matches {Pw/|P38W..P39W4D|}
I found the solution, it is in the REG Lexer rule, which does something with the forward-slash /
Because Lexer rules are executed before parser rules, it disturbs the good functioning of this rule:
cDuration:
( DURATION_CONSTRAINT_PATTERN ( '/' ( durationIntervalValue | durationValue ) )? | durationValue | durationListValue | durationIntervalValue | durationIntervalListValue ) assumedDurationValue? ;
assumedDurationValue: ';' durationValue ;
The solution is to make REG a parser rule instead of a lexer rule, by writing it in lower-case.
But then the rule needs some change, because it must allow .*
So the String-reg-expr becomes like this
regexConstraint: reg ;
reg: '/' ( '
/' | ~'/' | '.' )+ '/' | '' ( '
' | ~'^' | '.' )+ '^';
So this case can be closed after changing the grammar.
Thanks
See thread at https://github.com/openEHR/adl-antlr/issues/27