Problem with syntax like: duration_attr28 matches {Pw/|P38W..P39W4D|}
Raise
Analysis
Raise
Analysis
Description
Activity
Show:
Thomas Beale June 10, 2016 at 11:41 AM
See thread at https://github.com/openEHR/adl-antlr/issues/27
Details
Details
Created April 4, 2016 at 6:01 PM
Updated June 10, 2016 at 11:41 AM
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