@@ -4694,6 +4694,9 @@ grammar Regex is STD {
4694
4694
token category :quantifier { <sym > }
4695
4695
proto token quantifier {* }
4696
4696
4697
+ token category :cclass_elem { <sym > }
4698
+ proto token cclass_elem {* }
4699
+
4697
4700
token category :mod_internal { <sym > }
4698
4701
proto token mod_internal {* }
4699
4702
@@ -4958,6 +4961,7 @@ grammar Regex is STD {
4958
4961
token assertion :sym <??? > { <sym > }
4959
4962
token assertion :sym <!!! > { <sym > }
4960
4963
4964
+ token assertion :sym <| > { <sym > [ <? before '>' > | <? before \w > <assertion > ] } # assertion-like syntax, anyway
4961
4965
token assertion :sym <? > { <sym > [ <? before '>' > | <assertion > ] }
4962
4966
token assertion :sym <! > { <sym > [ <? before '>' > | <assertion > ] }
4963
4967
token assertion :sym <* > { <sym > [ <? before '>' > | <.ws > <nibbler > ] }
@@ -4993,27 +4997,61 @@ grammar Regex is STD {
4993
4997
]?
4994
4998
}
4995
4999
4996
- token assertion :sym <: > { <? before ':' <alpha >> <cclass_elem > + }
4997
- token assertion :sym <[ > { <? before '[' > <cclass_elem > + }
4998
- token assertion :sym <+ > { <? before '+' > <cclass_elem > + }
4999
- token assertion :sym <- > { <? before '-' > <cclass_elem > + }
5000
+ token assertion :sym <: > { <? before ':' <alpha >> <cclass_expr > }
5001
+ token assertion :sym <[ > { <? before '[' > <cclass_expr > }
5002
+ token assertion :sym <+ > { <? before '+' > <cclass_expr > }
5003
+ token assertion :sym <- > { <? before '-' > <cclass_expr > }
5000
5004
token assertion :sym <. > { <sym > }
5001
5005
token assertion :sym <, > { <sym > }
5002
5006
token assertion :sym <~~ > { <sym > [ <? before '>' > | \d + | <desigilname > ] }
5003
5007
5004
5008
token assertion :bogus { <.panic : "Unrecognized regex assertion" > }
5005
5009
5006
5010
token sign { '+' | '-' | <?> }
5007
- token cclass_elem {
5011
+ token cclass_expr {
5012
+ ::
5013
+ <.normspace >?
5014
+ <sign >
5015
+ <cclass_union > ** [$ < op > =[ '|' | '^' ]]
5016
+ }
5017
+
5018
+ token cclass_union {
5019
+ <.normspace >?
5020
+ <cclass_add > ** [$ < op > =[ '&' ]]
5021
+ }
5022
+
5023
+ token cclass_add {
5024
+ <.normspace >?
5025
+ <cclass_elem > ** [$ < op > =[ '+' | '-' ]]
5026
+ }
5027
+
5028
+ token cclass_elem :name {
5029
+ :dba ('character class element' )
5030
+ <.normspace >?
5031
+ <name >
5032
+ <.normspace >?
5033
+ }
5034
+
5035
+ token cclass_elem :sym <[ ] > {
5008
5036
:my $ * CCSTATE = '' ;
5009
5037
:dba ('character class element' )
5010
- <sign >
5011
5038
<.normspace >?
5012
- [
5013
- | <name >
5014
- | <before '[' > <quibble ($¢. cursor_fresh( % * LANG <Q > ).tweak (: cc))>
5015
- | [:lang (% * LANG <MAIN >) <colonpair > ]
5016
- ]
5039
+ <before '[' > <quibble ($¢. cursor_fresh( % * LANG <Q > ).tweak (: cc))>
5040
+ <.normspace >?
5041
+ }
5042
+
5043
+ token cclass_elem :sym <( ) > {
5044
+ :my $ * CCSTATE = '' ;
5045
+ :dba ('character class element' )
5046
+ <.normspace >?
5047
+ '(' ~ ')' <cclass_expr >
5048
+ <.normspace >?
5049
+ }
5050
+
5051
+ token cclass_elem :property {
5052
+ :dba ('character class element' )
5053
+ <.normspace >?
5054
+ [:lang (% * LANG <MAIN >) <colonpair > ]
5017
5055
<.normspace >?
5018
5056
}
5019
5057
0 commit comments