diff options
-rw-r--r-- | pygments/lexers/compiled.py | 6 | ||||
-rw-r--r-- | tests/examplefiles/example.f90 | 8 |
2 files changed, 11 insertions, 3 deletions
diff --git a/pygments/lexers/compiled.py b/pygments/lexers/compiled.py index 947282dd..82af5426 100644 --- a/pygments/lexers/compiled.py +++ b/pygments/lexers/compiled.py @@ -1622,9 +1622,9 @@ class FortranLexer(RegexLexer): ], 'nums': [ - (r'\d+(?![.Ee])', Number.Integer), - (r'[+-]?\d*\.\d+([eE][-+]?\d+)?', Number.Float), - (r'[+-]?\d+\.\d*([eE][-+]?\d+)?', Number.Float), + (r'\d+(?![.Ee])(_[a-z][a-z0-9_]+)?', Number.Integer), + (r'[+-]?\d*\.\d+([eE][-+]?\d+)?(_[a-z][a-z0-9_]+)?', Number.Float), + (r'[+-]?\d+\.\d*([eE][-+]?\d+)?(_[a-z][a-z0-9_]+)?', Number.Float), ], } diff --git a/tests/examplefiles/example.f90 b/tests/examplefiles/example.f90 new file mode 100644 index 00000000..40462189 --- /dev/null +++ b/tests/examplefiles/example.f90 @@ -0,0 +1,8 @@ +program main + integer, parameter :: mykind = selected_real_kind() + print *, 1 + print *, 1_mykind + print *, 1. + print *, 1._mykind + print *, (1., 1._mykind) +end program main |