File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -681,8 +681,20 @@ def all_lengths(self) -> Iterator[str]:
681
681
yield length
682
682
683
683
def patterns (self ) -> Iterator [Tuple [str , bool ]]:
684
- for pattern in self .pattern_details ():
685
- yield pattern .expression (), pattern .inverted ()
684
+ if not self .cdata_parsed or self .cdata .basetype != self .STRING :
685
+ return
686
+ if self .cdata_parsed .patterns == ffi .NULL :
687
+ return
688
+ for p in ly_array_iter (self .cdata_parsed .patterns ):
689
+ if not p :
690
+ continue
691
+ # in case of pattern restriction, the first byte has a special meaning:
692
+ # 0x06 (ACK) for regular match and 0x15 (NACK) for invert-match
693
+ invert_match = p .arg .str [0 ] == b"\x15 "
694
+ # yield tuples like:
695
+ # ('[a-zA-Z_][a-zA-Z0-9\-_.]*', False)
696
+ # ('[xX][mM][lL].*', True)
697
+ yield c2str (p .arg .str + 1 ), invert_match
686
698
687
699
def all_patterns (self ) -> Iterator [Tuple [str , bool ]]:
688
700
if self .cdata .basetype == lib .LY_TYPE_UNION :
You can’t perform that action at this time.
0 commit comments