summaryrefslogtreecommitdiffstats
path: root/contrib/tools/cython/Cython/Plex/Regexps.py
diff options
context:
space:
mode:
authornik-bes <[email protected]>2025-05-19 07:20:13 +0300
committernik-bes <[email protected]>2025-05-19 07:36:02 +0300
commit317b7368e24941ff76499f500579fd9b10f6656e (patch)
treeabbcbaea595e7d2e9f23cf59a408b3082fe4340d /contrib/tools/cython/Cython/Plex/Regexps.py
parent6b666a52d40308ab9b3532cd8d3008b9f37cfffb (diff)
Update Cython to 3.0.10.
commit_hash:b43c96b868cd36d636192fd2c6024d9f0d2fb6f8
Diffstat (limited to 'contrib/tools/cython/Cython/Plex/Regexps.py')
-rw-r--r--contrib/tools/cython/Cython/Plex/Regexps.py52
1 files changed, 8 insertions, 44 deletions
diff --git a/contrib/tools/cython/Cython/Plex/Regexps.py b/contrib/tools/cython/Cython/Plex/Regexps.py
index 41816c939ac..99d8c994a55 100644
--- a/contrib/tools/cython/Cython/Plex/Regexps.py
+++ b/contrib/tools/cython/Cython/Plex/Regexps.py
@@ -1,21 +1,16 @@
-#=======================================================================
-#
-# Python Lexical Analyser
-#
-# Regular Expressions
-#
-#=======================================================================
+"""
+Python Lexical Analyser
+Regular Expressions
+"""
from __future__ import absolute_import
import types
-try:
- from sys import maxsize as maxint
-except ImportError:
- from sys import maxint
from . import Errors
+maxint = 2**31-1 # sentinel value
+
#
# Constants
#
@@ -186,37 +181,6 @@ class RE(object):
# These are the basic REs from which all others are built.
#
-## class Char(RE):
-## """
-## Char(c) is an RE which matches the character |c|.
-## """
-
-## nullable = 0
-
-## def __init__(self, char):
-## self.char = char
-## self.match_nl = char == '\n'
-
-## def build_machine(self, m, initial_state, final_state, match_bol, nocase):
-## c = self.char
-## if match_bol and c != BOL:
-## s1 = self.build_opt(m, initial_state, BOL)
-## else:
-## s1 = initial_state
-## if c == '\n' or c == EOF:
-## s1 = self.build_opt(m, s1, EOL)
-## if len(c) == 1:
-## code = ord(self.char)
-## s1.add_transition((code, code+1), final_state)
-## if nocase and is_letter_code(code):
-## code2 = other_case_code(code)
-## s1.add_transition((code2, code2+1), final_state)
-## else:
-## s1.add_transition(c, final_state)
-
-## def calc_str(self):
-## return "Char(%s)" % repr(self.char)
-
def Char(c):
"""
@@ -428,6 +392,7 @@ class SwitchCase(RE):
name = "Case"
return "%s(%s)" % (name, self.re)
+
#
# Composite RE constructors
# -------------------------
@@ -469,7 +434,6 @@ def Any(s):
"""
Any(s) is an RE which matches any character in the string |s|.
"""
- #result = apply(Alt, tuple(map(Char, s)))
result = CodeRanges(chars_to_ranges(s))
result.str = "Any(%s)" % repr(s)
return result
@@ -549,6 +513,7 @@ def Case(re):
"""
return SwitchCase(re, nocase=0)
+
#
# RE Constants
#
@@ -573,4 +538,3 @@ Eof.__doc__ = \
Eof is an RE which matches the end of the file.
"""
Eof.str = "Eof"
-