diff options
author | Simon Hengel <sol@typeful.net> | 2018-12-19 23:06:04 +0800 |
---|---|---|
committer | Simon Hengel <sol@typeful.net> | 2018-12-19 23:06:04 +0800 |
commit | 07e9d8a0b09e40c8ac2a265e17aa47c3205a78d3 (patch) | |
tree | 3cffb653c98d6d4468bff1445e19a729ed75e379 /pygments/lexers/haskell.py | |
parent | 90f099f0aed96438ee293413caffd26f1758e380 (diff) | |
download | pygments-07e9d8a0b09e40c8ac2a265e17aa47c3205a78d3.tar.gz |
Add Hspec lexer
Diffstat (limited to 'pygments/lexers/haskell.py')
-rw-r--r-- | pygments/lexers/haskell.py | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/pygments/lexers/haskell.py b/pygments/lexers/haskell.py index 88d4a4df..b3884f5c 100644 --- a/pygments/lexers/haskell.py +++ b/pygments/lexers/haskell.py @@ -12,12 +12,12 @@ import re from pygments.lexer import Lexer, RegexLexer, bygroups, do_insertions, \ - default, include + default, include, inherit from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ Number, Punctuation, Generic from pygments import unistring as uni -__all__ = ['HaskellLexer', 'IdrisLexer', 'AgdaLexer', 'CryptolLexer', +__all__ = ['HaskellLexer', 'HspecLexer', 'IdrisLexer', 'AgdaLexer', 'CryptolLexer', 'LiterateHaskellLexer', 'LiterateIdrisLexer', 'LiterateAgdaLexer', 'LiterateCryptolLexer', 'KokaLexer'] @@ -157,6 +157,28 @@ class HaskellLexer(RegexLexer): } +class HspecLexer(HaskellLexer): + """ + A Haskell lexer with support for Hspec constructs. + + .. versionadded:: 2.4.0 + """ + + name = 'Hspec' + aliases = ['hspec'] + filenames = [] + mimetypes = [] + + tokens = { + 'root': [ + (r'(it\s*)("[^"]*")', bygroups(Text, String.Doc)), + (r'(describe\s*)("[^"]*")', bygroups(Text, String.Doc)), + (r'(context\s*)("[^"]*")', bygroups(Text, String.Doc)), + inherit, + ], + } + + class IdrisLexer(RegexLexer): """ A lexer for the dependently typed programming language Idris. |