Move ignore case indication to flags passed to re
Recent python does not make parsetab.py successfully, because some token regexp is starting with ?i flag. Remove that flag from regex and pass it as extra flags parameter instead.
This commit is contained in:
committed by
Mark Andrews
parent
6800f552f2
commit
b98658a99a
@@ -61,17 +61,17 @@ class PolicyLex:
|
||||
t.lexer.lineno += t.value.count('\n')
|
||||
|
||||
def t_DATESUFFIX(self, t):
|
||||
r'(?i)(?<=[0-9 \t])(y(?:ears|ear|ea|e)?|mo(?:nths|nth|nt|n)?|w(?:eeks|eek|ee|e)?|d(?:ays|ay|a)?|h(?:ours|our|ou|o)?|mi(?:nutes|nute|nut|nu|n)?|s(?:econds|econd|econ|eco|ec|e)?)\b'
|
||||
t.value = re.match(r'(?i)(y|mo|w|d|h|mi|s)([a-z]*)', t.value).group(1).lower()
|
||||
r'(?<=[0-9 \t])(y(?:ears|ear|ea|e)?|mo(?:nths|nth|nt|n)?|w(?:eeks|eek|ee|e)?|d(?:ays|ay|a)?|h(?:ours|our|ou|o)?|mi(?:nutes|nute|nut|nu|n)?|s(?:econds|econd|econ|eco|ec|e)?)\b'
|
||||
t.value = re.match(r'(y|mo|w|d|h|mi|s)([a-z]*)', t.value, re.IGNORECASE).group(1).lower()
|
||||
return t
|
||||
|
||||
def t_KEYTYPE(self, t):
|
||||
r'(?i)\b(KSK|ZSK)\b'
|
||||
r'\b(KSK|ZSK)\b'
|
||||
t.value = t.value.upper()
|
||||
return t
|
||||
|
||||
def t_ALGNAME(self, t):
|
||||
r'(?i)\b(DH|ECC|RSASHA1|NSEC3RSASHA1|RSASHA256|RSASHA512|ECDSAP256SHA256|ECDSAP384SHA384|ED25519|ED448)\b'
|
||||
r'\b(DH|ECC|RSASHA1|NSEC3RSASHA1|RSASHA256|RSASHA512|ECDSAP256SHA256|ECDSAP384SHA384|ED25519|ED448)\b'
|
||||
t.value = t.value.upper()
|
||||
return t
|
||||
|
||||
@@ -102,7 +102,7 @@ class PolicyLex:
|
||||
trans = maketrans('_', '-')
|
||||
for r in self.reserved:
|
||||
self.reserved_map[r.lower().translate(trans)] = r
|
||||
self.lexer = lex.lex(object=self, **kwargs)
|
||||
self.lexer = lex.lex(object=self, reflags=re.VERBOSE|re.IGNORECASE, **kwargs)
|
||||
|
||||
def test(self, text):
|
||||
self.lexer.input(text)
|
||||
|
||||
Reference in New Issue
Block a user