diff options
author | Gaurav Jain <gaurav@gauravjain.org> | 2014-04-17 22:04:35 -0400 |
---|---|---|
committer | Gaurav Jain <gaurav@gauravjain.org> | 2014-04-17 22:04:35 -0400 |
commit | 9b44e016296ec1a1a43ffd513417d6d82c4ef35b (patch) | |
tree | c623d4f8b812c3ab26901fd94b1414aa49228fc5 | |
parent | 84b7c8aca975566dde86fc90a23d49353e534265 (diff) | |
download | pygments-9b44e016296ec1a1a43ffd513417d6d82c4ef35b.tar.gz |
Add support for kind paramter for integer and real types
Integers and reals can have an optional kind parameter specified with an underscore. This could have the format of any variable name. Additionally added example file to demonstrate usage.
-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 |