From e6718dabc976bc1aa7694d75ca052f9bac9ad2da Mon Sep 17 00:00:00 2001 From: Kohei Noda Date: Mon, 13 Feb 2023 17:10:47 +0900 Subject: [PATCH] Support the letters q and Q. quadruple_precision expressions --- fortran_tests/after/quadruple.f90 | 9 +++++++++ fortran_tests/before/quadruple.f90 | 9 +++++++++ fortran_tests/test_results/expected_results | 1 + fprettify/__init__.py | 2 +- 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 fortran_tests/after/quadruple.f90 create mode 100644 fortran_tests/before/quadruple.f90 diff --git a/fortran_tests/after/quadruple.f90 b/fortran_tests/after/quadruple.f90 new file mode 100644 index 0000000..eb9822d --- /dev/null +++ b/fortran_tests/after/quadruple.f90 @@ -0,0 +1,9 @@ +program test_quadruple_precision + implicit none + real(16) :: r + complex*32 :: cmp + + r = 1.0q+00 + cmp = (1.0Q+00, 2.0Q-01) + +end program test_quadruple_precision diff --git a/fortran_tests/before/quadruple.f90 b/fortran_tests/before/quadruple.f90 new file mode 100644 index 0000000..5edd84e --- /dev/null +++ b/fortran_tests/before/quadruple.f90 @@ -0,0 +1,9 @@ +program test_quadruple_precision + implicit none + real(16) :: r + complex*32 :: cmp + + r = 1.0q+00 + cmp= ( 1.0Q+00,2.0Q-01) + +end program test_quadruple_precision diff --git a/fortran_tests/test_results/expected_results b/fortran_tests/test_results/expected_results index e109307..461f2c2 100644 --- a/fortran_tests/test_results/expected_results +++ b/fortran_tests/test_results/expected_results @@ -2265,3 +2265,4 @@ cp2k/src/xas_tdp_types.F : 728f382598e79fa0e7b3be6d88a3218fea45e19744bbe7bdaaa96 cp2k/src/xas_tdp_utils.F : 002dfdc6e9d5979516458b6f890950bd94df49e947633a7253b46be5f3fd7d61 cp2k/src/xc/xc_sr_lda.F : 094099ac92a6749028c004d37b7646e2af7de402ee5804de27192b56588cc7fe cp2k/src/xtb_ehess.F : 45fe2c022760195affb0fd5155d865b6deac896cf6e6714e772bef04afad4be2 +quadruple.f90 : a66ec6d7d8041d903a0bef18fc13caa9a50eacb1712fe614752920c144249ed7 diff --git a/fprettify/__init__.py b/fprettify/__init__.py index d6450a3..7d5d9ab 100644 --- a/fprettify/__init__.py +++ b/fprettify/__init__.py @@ -241,7 +241,7 @@ class plusminus_parser(parser_re): """ def __init__(self, regex): self._re = regex - self._re_excl = re.compile(r"\b(\d+\.?\d*|\d*\.?\d+)[de]" + EOL_STR, RE_FLAGS) + self._re_excl = re.compile(r"\b(\d+\.?\d*|\d*\.?\d+)[deq]" + EOL_STR, RE_FLAGS) def split(self, line): partsplit = self._re.split(line)