diff --git a/tatsu/buffering.py b/tatsu/buffering.py index 6872847..82e7a36 100644 --- a/tatsu/buffering.py +++ b/tatsu/buffering.py @@ -268,11 +268,11 @@ def eat_whitespace(self): return self._eat_regex(self.whitespace_re) def eat_comments(self): - comments = self._eat_regex_list(self.config.comments_pattern) + comments = self._eat_regex_list(cached_re_compile(self.config.comments)) self._index_comments(comments, lambda x: x.inline) def eat_eol_comments(self): - comments = self._eat_regex_list(self.config.eol_comments_pattern) + comments = self._eat_regex_list(cached_re_compile(self.config.eol_comments)) self._index_comments(comments, lambda x: x.eol) def next_token(self): diff --git a/tatsu/infos.py b/tatsu/infos.py index 9b7d8a9..1fb8e68 100644 --- a/tatsu/infos.py +++ b/tatsu/infos.py @@ -9,7 +9,6 @@ from .ast import AST from .tokenizing import Tokenizer -from .util.misc import cached_re_compile from .util.unicode_characters import C_DERIVE @@ -95,18 +94,6 @@ def new( # NOTE: # Using functools.cache directly makes objects of this class unhashable - @property - def comments_pattern(self) -> re.Pattern | None: - return cached_re_compile(self.comments) - - @property - def eol_comments_pattern(self) -> re.Pattern | None: - return cached_re_compile(self.eol_comments) - - @property - def whitespace_pattern(self) -> re.Pattern | None: - return cached_re_compile(self.whitespace) - def effective_rule_name(self): # note: there are legacy reasons for this mess return self.start_rule or self.rule_name or self.start