Skip to content

Commit

Permalink
Improve/fix CQL grammar (regexp char. classes)
Browse files Browse the repository at this point in the history
(support ticket 2930)
  • Loading branch information
tomachalek committed Sep 24, 2024
1 parent 110d49d commit 2e24371
Showing 1 changed file with 36 additions and 4 deletions.
40 changes: 36 additions & 4 deletions scripts/build/cql.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@ NO_RG_ESCAPED =
// ---------------- Regular expression with balanced parentheses --------

RegExp =
QUOT RegExpRaw QUOT / QUOT QUOT
QUOT RegExpRaw ("|" RegExpRaw?)* QUOT / QUOT QUOT

RegExpRaw =
(RgLook / RgGrouped / RgSimple)+

RgGrouped =
LPAREN _ RegExpRaw _ RPAREN
LPAREN _ RegExpRaw ("|" RegExpRaw?)* _ RPAREN

RgSimple =
(RgRange / RgChar / RgAlt / RgPosixClass)+
Expand All @@ -154,10 +154,42 @@ RgLookOperator =


RgAlt =
LBRACKET (RgChar / DASH)+ RBRACKET
LBRACKET RG_CARET? RgAltVal+ RBRACKET

RgAltVal =
AnyLetter "-" AnyLetter /
RgChar /
"|" /
QUOT /
LBRACE /
RBRACE /
LPAREN /
RPAREN /
DASH

RgChar =
RG_ESCAPED / AnyLetter / RG_OP / RG_NON_LETTER / RG_NON_SPEC / RG_AMP / RG_UNICODE_PROP
RG_ESCAPED /
RG_REPEAT /
RG_QM /
RG_ANY /
AnyLetter /
RG_OP /
RG_NON_LETTER /
RG_NON_SPEC /
RG_AMP /
RG_UNICODE_PROP

RG_CARET =
"^"

RG_QM =
"?"

RG_ANY =
"."

RG_REPEAT =
[*+]

RG_OP =
[,\-_\^\$ ] / [0-9\?\*\+\.\|]
Expand Down

0 comments on commit 2e24371

Please sign in to comment.