Skip to content

Commit

Permalink
Merge pull request #273 from gerlero/files
Browse files Browse the repository at this point in the history
Update parsing
  • Loading branch information
gerlero authored Nov 15, 2024
2 parents 4a5dcc1 + 18e9472 commit e8f549d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions foamlib/_files/_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def _list_of(entry: ParserElement) -> ParserElement:

def _counted_tensor_list(*, size: int, ignore: Regex) -> ParserElement:
float_pattern = r"[+-]?((\d+\.?\d*(e[+-]?\d+)?)|nan|inf(inity)?)"
ignore_pattern = rf"(?:{ignore.re.pattern}|\s)+"
ignore_pattern = rf"(?:\s|{ignore.re.pattern})+"

if size == 1:
tensor_pattern = float_pattern
Expand All @@ -83,7 +83,7 @@ def count_parse_action(tks: ParseResults) -> None:

list_ <<= Regex(
rf"\((?:{ignore_pattern})?(?:{tensor_pattern}{ignore_pattern}){{{length - 1}}}{tensor_pattern}(?:{ignore_pattern})?\)",
re.IGNORECASE,
flags=re.IGNORECASE,
)

count = common.integer.add_parse_action(count_parse_action)
Expand Down

0 comments on commit e8f549d

Please sign in to comment.