summaryrefslogtreecommitdiff
path: root/pygments/lexers/haskell.py
diff options
context:
space:
mode:
authorSimon Hengel <sol@typeful.net>2018-12-19 23:06:04 +0800
committerSimon Hengel <sol@typeful.net>2018-12-19 23:06:04 +0800
commit07e9d8a0b09e40c8ac2a265e17aa47c3205a78d3 (patch)
tree3cffb653c98d6d4468bff1445e19a729ed75e379 /pygments/lexers/haskell.py
parent90f099f0aed96438ee293413caffd26f1758e380 (diff)
downloadpygments-07e9d8a0b09e40c8ac2a265e17aa47c3205a78d3.tar.gz
Add Hspec lexer
Diffstat (limited to 'pygments/lexers/haskell.py')
-rw-r--r--pygments/lexers/haskell.py26
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.