@@ -36,7 +36,7 @@ class CharClass(object):
3636
3737 charSetSize = 256 # must be a multiple of 16
3838
39- def __init__ (self , name : str , s : Union [Set [int ], Set [Union [int , str ]]]) -> None :
39+ def __init__ (self , name : str , s : Union [Set [int ], Set [Union [int , str ]]], trace : Trace ) -> None :
4040 assert isinstance (name , str )
4141 assert isinstance (s , set )
4242 if name == "#" :
@@ -45,6 +45,7 @@ def __init__(self, name: str, s: Union[Set[int], Set[Union[int, str]]]) -> None:
4545 self .n = len (__class__ .classes ) # class number
4646 self .name = name # class name
4747 self .set = s # set representing the class
48+ self .trace = trace
4849 self .__class__ .classes .append (self )
4950
5051 @staticmethod
@@ -81,11 +82,11 @@ def Ch(ch):
8182 @staticmethod
8283 def WriteClasses ():
8384 for c in __class__ .classes :
84- Trace .Write (str (c .name ), - 10 )
85- Trace .Write (": " )
85+ self . trace .Write (str (c .name ), - 10 )
86+ self . trace .Write (": " )
8687 c .WriteSet ()
87- Trace .WriteLine ()
88- Trace .WriteLine ()
88+ self . trace .WriteLine ()
89+ self . trace .WriteLine ()
8990
9091 def WriteSet (self ):
9192 s = self .set .copy ()
@@ -105,6 +106,6 @@ def WriteSet(self):
105106 while i < mx and (i in s ):
106107 i += 1
107108 if j < (i - 1 ):
108- Trace .Write (str (self .__class__ .Ch (j )) + ".." + str (self .__class__ .Ch (i - 1 )) + " " )
109+ self . trace .Write (str (self .__class__ .Ch (j )) + ".." + str (self .__class__ .Ch (i - 1 )) + " " )
109110 else :
110- Trace .Write (str (self .__class__ .Ch (j ) + " " ))
111+ self . trace .Write (str (self .__class__ .Ch (j ) + " " ))
0 commit comments