diff --git a/regex_humanizer/parser.py b/regex_humanizer/parser.py index 5191ab6..59b6374 100644 --- a/regex_humanizer/parser.py +++ b/regex_humanizer/parser.py @@ -1,6 +1,4 @@ -"""Regex parser for converting regex patterns to AST nodes.""" - -from typing import Optional, Union, Any +from typing import Optional, Any from dataclasses import dataclass, field from enum import Enum @@ -355,7 +353,7 @@ class RegexParser: self.pos = end + 1 return RegexNode( node_type=NodeType.UNICODE_PROPERTY, - raw=f'\\p{{{prop}}}') + raw=f'\\p{{{prop}}}', position=self.pos - len(f'\\p{{{prop}}}') ) @@ -558,7 +556,6 @@ class RegexParser: is_non_capturing=False ) elif next_char in 'iDsx': - flag = next_char self.pos += 1 children = self._parse_sequence() return RegexNode( @@ -592,7 +589,6 @@ class RegexParser: if char in '*+?': self.pos += 1 - quant_type = char if char == '*': min_count = 0 max_count = float('inf') @@ -634,7 +630,6 @@ class RegexParser: is_possessive = True self.pos += 1 - quant_type = '{' + quant_content + '}' else: return None