summaryrefslogtreecommitdiff
path: root/pygments/lexers/haskell.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2022-06-17 07:24:39 +0200
committerGeorg Brandl <georg@python.org>2022-06-17 07:24:39 +0200
commit6eab78a1a04ec63355b59125fd8572aa6684dd5b (patch)
tree27da67dccce171d8f9ff945e0135ace7f1d24688 /pygments/lexers/haskell.py
parentc4f6764bcf38883b0f2a02f8933e979b20d10ec0 (diff)
downloadpygments-git-6eab78a1a04ec63355b59125fd8572aa6684dd5b.tar.gz
agda: allow ticks in module names
Fixes #2163
Diffstat (limited to 'pygments/lexers/haskell.py')
-rw-r--r--pygments/lexers/haskell.py24
1 files changed, 14 insertions, 10 deletions
diff --git a/pygments/lexers/haskell.py b/pygments/lexers/haskell.py
index c5c5ca12..2f03174f 100644
--- a/pygments/lexers/haskell.py
+++ b/pygments/lexers/haskell.py
@@ -305,19 +305,22 @@ class AgdaLexer(RegexLexer):
filenames = ['*.agda']
mimetypes = ['text/x-agda']
- reserved = ['abstract', 'codata', 'coinductive', 'constructor', 'data', 'do',
- 'eta-equality', 'field', 'forall', 'hiding', 'in', 'inductive', 'infix',
- 'infixl', 'infixr', 'instance', 'interleaved', 'let', 'macro', 'mutual',
- 'no-eta-equality', 'open', 'overlap', 'pattern', 'postulate', 'primitive', 'private',
- 'quote', 'quoteTerm',
- 'record', 'renaming', 'rewrite', 'syntax', 'tactic',
- 'unquote', 'unquoteDecl', 'unquoteDef', 'using', 'variable', 'where', 'with']
+ reserved = (
+ 'abstract', 'codata', 'coinductive', 'constructor', 'data', 'do',
+ 'eta-equality', 'field', 'forall', 'hiding', 'in', 'inductive', 'infix',
+ 'infixl', 'infixr', 'instance', 'interleaved', 'let', 'macro', 'mutual',
+ 'no-eta-equality', 'open', 'overlap', 'pattern', 'postulate', 'primitive',
+ 'private', 'quote', 'quoteTerm', 'record', 'renaming', 'rewrite',
+ 'syntax', 'tactic', 'unquote', 'unquoteDecl', 'unquoteDef', 'using',
+ 'variable', 'where', 'with',
+ )
tokens = {
'root': [
# Declaration
(r'^(\s*)([^\s(){}]+)(\s*)(:)(\s*)',
- bygroups(Whitespace, Name.Function, Whitespace, Operator.Word, Whitespace)),
+ bygroups(Whitespace, Name.Function, Whitespace,
+ Operator.Word, Whitespace)),
# Comments
(r'--(?![!#$%&*+./<=>?@^|_~:\\]).*?$', Comment.Single),
(r'\{-', Comment.Multiline, 'comment'),
@@ -326,7 +329,8 @@ class AgdaLexer(RegexLexer):
# Lexemes:
# Identifiers
(r'\b(%s)(?!\')\b' % '|'.join(reserved), Keyword.Reserved),
- (r'(import|module)(\s+)', bygroups(Keyword.Reserved, Whitespace), 'module'),
+ (r'(import|module)(\s+)', bygroups(Keyword.Reserved, Whitespace),
+ 'module'),
(r'\b(Set|Prop)[\u2080-\u2089]*\b', Keyword.Type),
# Special Symbols
(r'(\(|\)|\{|\})', Operator),
@@ -351,7 +355,7 @@ class AgdaLexer(RegexLexer):
],
'module': [
(r'\{-', Comment.Multiline, 'comment'),
- (r'[a-zA-Z][\w.]*', Name, '#pop'),
+ (r'[a-zA-Z][\w.\']*', Name, '#pop'),
(r'[\W0-9_]+', Text)
],
'comment': HaskellLexer.tokens['comment'],