bpo-34681: Rename class Pattern in sre_parse to State. (GH-9310)

Also rename corresponding attributes, parameters and variables.
diff --git a/Lib/sre_compile.py b/Lib/sre_compile.py
index e5216b7..3667042 100644
--- a/Lib/sre_compile.py
+++ b/Lib/sre_compile.py
@@ -597,7 +597,7 @@
 
 def _code(p, flags):
 
-    flags = p.pattern.flags | flags
+    flags = p.state.flags | flags
     code = []
 
     # compile info block
@@ -772,13 +772,13 @@
         dis(code)
 
     # map in either direction
-    groupindex = p.pattern.groupdict
-    indexgroup = [None] * p.pattern.groups
+    groupindex = p.state.groupdict
+    indexgroup = [None] * p.state.groups
     for k, i in groupindex.items():
         indexgroup[i] = k
 
     return _sre.compile(
-        pattern, flags | p.pattern.flags, code,
-        p.pattern.groups-1,
+        pattern, flags | p.state.flags, code,
+        p.state.groups-1,
         groupindex, tuple(indexgroup)
         )