From f91963a6ffd4d17e338e1d4ee3b9171889fc45b0 Mon Sep 17 00:00:00 2001 From: Tim Baumann Date: Sun, 19 May 2013 02:31:57 +0200 Subject: Added lexer for Agda --- pygments/lexers/_mapping.py | 1 + pygments/lexers/functional.py | 74 +++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 73 insertions(+), 2 deletions(-) (limited to 'pygments/lexers') diff --git a/pygments/lexers/_mapping.py b/pygments/lexers/_mapping.py index bcb17e5a..b29d8262 100644 --- a/pygments/lexers/_mapping.py +++ b/pygments/lexers/_mapping.py @@ -18,6 +18,7 @@ LEXERS = { 'ActionScript3Lexer': ('pygments.lexers.web', 'ActionScript 3', ('as3', 'actionscript3'), ('*.as',), ('application/x-actionscript', 'text/x-actionscript', 'text/actionscript')), 'ActionScriptLexer': ('pygments.lexers.web', 'ActionScript', ('as', 'actionscript'), ('*.as',), ('application/x-actionscript3', 'text/x-actionscript3', 'text/actionscript3')), 'AdaLexer': ('pygments.lexers.compiled', 'Ada', ('ada', 'ada95ada2005'), ('*.adb', '*.ads', '*.ada'), ('text/x-ada',)), + 'AgdaLexer': ('pygments.lexers.functional', 'Agda', ('agda',), ('*.agda',), ('text/x-agda',)), 'AntlrActionScriptLexer': ('pygments.lexers.parsers', 'ANTLR With ActionScript Target', ('antlr-as', 'antlr-actionscript'), ('*.G', '*.g'), ()), 'AntlrCSharpLexer': ('pygments.lexers.parsers', 'ANTLR With C# Target', ('antlr-csharp', 'antlr-c#'), ('*.G', '*.g'), ()), 'AntlrCppLexer': ('pygments.lexers.parsers', 'ANTLR With CPP Target', ('antlr-cpp',), ('*.G', '*.g'), ()), diff --git a/pygments/lexers/functional.py b/pygments/lexers/functional.py index 613be987..32e557ca 100644 --- a/pygments/lexers/functional.py +++ b/pygments/lexers/functional.py @@ -17,8 +17,8 @@ from pygments.token import Text, Comment, Operator, Keyword, Name, \ __all__ = ['RacketLexer', 'SchemeLexer', 'CommonLispLexer', 'HaskellLexer', 'LiterateHaskellLexer', 'SMLLexer', 'OcamlLexer', 'ErlangLexer', - 'ErlangShellLexer', 'OpaLexer', 'CoqLexer', 'NewLispLexer', - 'ElixirLexer', 'ElixirConsoleLexer', 'KokaLexer'] + 'ErlangShellLexer', 'OpaLexer', 'CoqLexer', 'AgdaLexer', + 'NewLispLexer', 'ElixirLexer', 'ElixirConsoleLexer', 'KokaLexer'] class RacketLexer(RegexLexer): @@ -1081,6 +1081,76 @@ class LiterateHaskellLexer(Lexer): yield item +class AgdaLexer(RegexLexer): + """ + For the `Agda `_ + dependently typed functional programming language and proof assistant. + """ + + name = 'Agda' + aliases = ['agda'] + filenames = ['*.agda'] + mimetypes = ['text/x-agda'] + + reserved = ['abstract', 'codata', 'coinductive', 'data', 'field', + 'forall', 'hiding', 'in', 'inductive', 'infix', 'infixl', + 'infixr', 'let', 'open', 'pattern', 'primitive', 'private', + 'mutual', 'quote', 'quoteGoal', 'quoteTerm', 'record', + 'syntax', 'rewrite', 'unquote', 'using', 'where', 'with'] + + tokens = { + 'root': [ + # Declaration + (r'^(\s*)([^\s\(\)\{\}]+)(\s*)(:)(\s*)', bygroups(Text, Name.Function, Text, Operator.Word, Text)), + (r'\s+', Text), # Whitespace + # Comments + (r'--(?![!#$%&*+./<=>?@\^|_~:\\]).*?$', Comment.Single), + (r'{-', Comment.Multiline, 'comment'), + # Holes + (r'{!', Comment.Directive, 'hole'), + # Lexemes: + # Identifiers + (ur'\b(%s)(?!\')\b' % '|'.join(reserved), Keyword.Reserved), + (r'(import)(\s+)([A-Z][a-zA-Z0-9_.]*)', bygroups(Keyword.Reserved, Text, Name)), + (r'(module)(\s+)([A-Z][a-zA-Z0-9_.]*)', bygroups(Keyword.Reserved, Text, Name)), + (r'\b(Set|Prop)\b', Keyword.Type), + # Special Symbols + (r'(\(|\)|\{|\})', Operator), + (ur'(\.{1,3}|\||[\u039B]|[\u2200]|[\u2192]|:|=|->)', Operator.Word), + #(r'\\(?![:!#$%&*+.\\/<=>?@^|~-]+)', Name.Function), # lambda operator + #(r'(<-|::|->|=>|=)(?![:!#$%&*+.\\/<=>?@^|~-]+)', Operator.Word), # specials + #(r':[:!#$%&*+.\\/<=>?@^|~-]*', Keyword.Type), # Constructor operators + #(r'[:!#$%&*+.\\/<=>?@^|~-]+', Operator), # Other operators + # Numbers + (r'\d+[eE][+-]?\d+', Number.Float), + (r'\d+\.\d+([eE][+-]?\d+)?', Number.Float), + (r'0[xX][\da-fA-F]+', Number.Hex), + (r'\d+', Number.Integer), + # Strings + (r"'", String.Char, 'character'), + (r'"', String, 'string'), + (r'[^\s\(\)\{\}]+', Text), + ], + 'comment': [ + # Multiline Comments + (r'[^-{}]+', Comment.Multiline), + (r'{-', Comment.Multiline, '#push'), + (r'-}', Comment.Multiline, '#pop'), + (r'[-{}]', Comment.Multiline), + ], + 'hole': [ + # Holes + (r'[^!{}]+', Comment.Directive), + (r'{!', Comment.Directive, '#push'), + (r'!}', Comment.Directive, '#pop'), + (r'[!{}]', Comment.Directive), + ], + 'character': HaskellLexer.tokens['character'], + 'string': HaskellLexer.tokens['string'], + 'escape': HaskellLexer.tokens['escape'] + } + + class SMLLexer(RegexLexer): """ For the Standard ML language. -- cgit v1.2.1 From bc00600db992c277770fd3651e8a49aca4b58303 Mon Sep 17 00:00:00 2001 From: Tim Baumann Date: Sun, 19 May 2013 04:00:35 +0200 Subject: Add support for Literate Agda (factoring out some helper functions from the Literate Haskell implementation) --- pygments/lexers/_mapping.py | 1 + pygments/lexers/functional.py | 117 ++++++++++++++++++++++++++---------------- 2 files changed, 74 insertions(+), 44 deletions(-) (limited to 'pygments/lexers') diff --git a/pygments/lexers/_mapping.py b/pygments/lexers/_mapping.py index b29d8262..9fd8f713 100644 --- a/pygments/lexers/_mapping.py +++ b/pygments/lexers/_mapping.py @@ -162,6 +162,7 @@ LEXERS = { 'LassoLexer': ('pygments.lexers.web', 'Lasso', ('lasso', 'lassoscript'), ('*.lasso', '*.lasso[89]'), ('text/x-lasso',)), 'LassoXmlLexer': ('pygments.lexers.templates', 'XML+Lasso', ('xml+lasso',), (), ('application/xml+lasso',)), 'LighttpdConfLexer': ('pygments.lexers.text', 'Lighttpd configuration file', ('lighty', 'lighttpd'), (), ('text/x-lighttpd-conf',)), + 'LiterateAgdaLexer': ('pygments.lexers.functional', 'Literate Agda', ('lagda', 'literate-agda'), ('*.lagda',), ('text/x-literate-agda',)), 'LiterateHaskellLexer': ('pygments.lexers.functional', 'Literate Haskell', ('lhs', 'literate-haskell'), ('*.lhs',), ('text/x-literate-haskell',)), 'LiveScriptLexer': ('pygments.lexers.web', 'LiveScript', ('live-script', 'livescript'), ('*.ls',), ('text/livescript',)), 'LlvmLexer': ('pygments.lexers.asm', 'LLVM', ('llvm',), ('*.ll',), ('text/x-llvm',)), diff --git a/pygments/lexers/functional.py b/pygments/lexers/functional.py index 32e557ca..41aac7a4 100644 --- a/pygments/lexers/functional.py +++ b/pygments/lexers/functional.py @@ -16,9 +16,10 @@ from pygments.token import Text, Comment, Operator, Keyword, Name, \ String, Number, Punctuation, Literal, Generic, Error __all__ = ['RacketLexer', 'SchemeLexer', 'CommonLispLexer', 'HaskellLexer', - 'LiterateHaskellLexer', 'SMLLexer', 'OcamlLexer', 'ErlangLexer', - 'ErlangShellLexer', 'OpaLexer', 'CoqLexer', 'AgdaLexer', - 'NewLispLexer', 'ElixirLexer', 'ElixirConsoleLexer', 'KokaLexer'] + 'LiterateHaskellLexer', 'AgdaLexer', 'LiterateAgdaLexer', + 'SMLLexer', 'OcamlLexer', 'ErlangLexer', 'ErlangShellLexer', + 'OpaLexer', 'CoqLexer', 'AgdaLexer', 'NewLispLexer', 'ElixirLexer', + 'ElixirConsoleLexer', 'KokaLexer'] class RacketLexer(RegexLexer): @@ -1014,6 +1015,52 @@ class HaskellLexer(RegexLexer): line_re = re.compile('.*?\n') bird_re = re.compile(r'(>[ \t]*)(.*\n)') +# bird-style +def _bird_get_tokens_unprocessed(text, baselexer): + code = '' + insertions = [] + for match in line_re.finditer(text): + line = match.group() + m = bird_re.match(line) + if m: + insertions.append((len(code), + [(0, Comment.Special, m.group(1))])) + code += m.group(2) + else: + insertions.append((len(code), [(0, Text, line)])) + for item in do_insertions(insertions, baselexer.get_tokens_unprocessed(code)): + yield item + + +# latex-style +def _latex_get_tokens_unprocessed(text, baselexer, lxlexer): + code = '' + insertions = [] + + codelines = 0 + latex = '' + for match in line_re.finditer(text): + line = match.group() + if codelines: + if line.lstrip().startswith('\\end{code}'): + codelines = 0 + latex += line + else: + code += line + elif line.lstrip().startswith('\\begin{code}'): + codelines = 1 + latex += line + insertions.append((len(code), + list(lxlexer.get_tokens_unprocessed(latex)))) + latex = '' + else: + latex += line + insertions.append((len(code), + list(lxlexer.get_tokens_unprocessed(latex)))) + for item in do_insertions(insertions, baselexer.get_tokens_unprocessed(code)): + yield item + + class LiterateHaskellLexer(Lexer): """ For Literate Haskell (Bird-style or LaTeX) source. @@ -1039,46 +1086,14 @@ class LiterateHaskellLexer(Lexer): if style is None: style = (text.lstrip()[0:1] in '%\\') and 'latex' or 'bird' - code = '' - insertions = [] if style == 'bird': - # bird-style - for match in line_re.finditer(text): - line = match.group() - m = bird_re.match(line) - if m: - insertions.append((len(code), - [(0, Comment.Special, m.group(1))])) - code += m.group(2) - else: - insertions.append((len(code), [(0, Text, line)])) + for item in _bird_get_tokens_unprocessed(text, hslexer): + yield item else: - # latex-style from pygments.lexers.text import TexLexer lxlexer = TexLexer(**self.options) - - codelines = 0 - latex = '' - for match in line_re.finditer(text): - line = match.group() - if codelines: - if line.lstrip().startswith('\\end{code}'): - codelines = 0 - latex += line - else: - code += line - elif line.lstrip().startswith('\\begin{code}'): - codelines = 1 - latex += line - insertions.append((len(code), - list(lxlexer.get_tokens_unprocessed(latex)))) - latex = '' - else: - latex += line - insertions.append((len(code), - list(lxlexer.get_tokens_unprocessed(latex)))) - for item in do_insertions(insertions, hslexer.get_tokens_unprocessed(code)): - yield item + for item in _latex_get_tokens_unprocessed(text, hslexer, lxlexer): + yield item class AgdaLexer(RegexLexer): @@ -1102,7 +1117,6 @@ class AgdaLexer(RegexLexer): 'root': [ # Declaration (r'^(\s*)([^\s\(\)\{\}]+)(\s*)(:)(\s*)', bygroups(Text, Name.Function, Text, Operator.Word, Text)), - (r'\s+', Text), # Whitespace # Comments (r'--(?![!#$%&*+./<=>?@\^|_~:\\]).*?$', Comment.Single), (r'{-', Comment.Multiline, 'comment'), @@ -1117,10 +1131,6 @@ class AgdaLexer(RegexLexer): # Special Symbols (r'(\(|\)|\{|\})', Operator), (ur'(\.{1,3}|\||[\u039B]|[\u2200]|[\u2192]|:|=|->)', Operator.Word), - #(r'\\(?![:!#$%&*+.\\/<=>?@^|~-]+)', Name.Function), # lambda operator - #(r'(<-|::|->|=>|=)(?![:!#$%&*+.\\/<=>?@^|~-]+)', Operator.Word), # specials - #(r':[:!#$%&*+.\\/<=>?@^|~-]*', Keyword.Type), # Constructor operators - #(r'[:!#$%&*+.\\/<=>?@^|~-]+', Operator), # Other operators # Numbers (r'\d+[eE][+-]?\d+', Number.Float), (r'\d+\.\d+([eE][+-]?\d+)?', Number.Float), @@ -1130,6 +1140,7 @@ class AgdaLexer(RegexLexer): (r"'", String.Char, 'character'), (r'"', String, 'string'), (r'[^\s\(\)\{\}]+', Text), + (r'\s+?', Text), # Whitespace ], 'comment': [ # Multiline Comments @@ -1151,6 +1162,24 @@ class AgdaLexer(RegexLexer): } +class LiterateAgdaLexer(Lexer): + """ + For Literate Agda source. + """ + name = 'Literate Agda' + aliases = ['lagda', 'literate-agda'] + filenames = ['*.lagda'] + mimetypes = ['text/x-literate-agda'] + + def get_tokens_unprocessed(self, text): + agdalexer = AgdaLexer(**self.options) + + from pygments.lexers.text import TexLexer + lxlexer = TexLexer(**self.options) + for item in _latex_get_tokens_unprocessed(text, agdalexer, lxlexer): + yield item + + class SMLLexer(RegexLexer): """ For the Standard ML language. -- cgit v1.2.1 From 91aeb371752f8c10dda0bbc156452bcb6839bd21 Mon Sep 17 00:00:00 2001 From: Tim Baumann Date: Sun, 19 May 2013 20:58:32 +0200 Subject: Test files for Agda and literate Agda mode --- pygments/lexers/functional.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'pygments/lexers') diff --git a/pygments/lexers/functional.py b/pygments/lexers/functional.py index 41aac7a4..edd139c1 100644 --- a/pygments/lexers/functional.py +++ b/pygments/lexers/functional.py @@ -1107,11 +1107,12 @@ class AgdaLexer(RegexLexer): filenames = ['*.agda'] mimetypes = ['text/x-agda'] - reserved = ['abstract', 'codata', 'coinductive', 'data', 'field', - 'forall', 'hiding', 'in', 'inductive', 'infix', 'infixl', - 'infixr', 'let', 'open', 'pattern', 'primitive', 'private', - 'mutual', 'quote', 'quoteGoal', 'quoteTerm', 'record', - 'syntax', 'rewrite', 'unquote', 'using', 'where', 'with'] + reserved = ['abstract', 'codata', 'coinductive', 'constructor', 'data', + 'field', 'forall', 'hiding', 'in', 'inductive', 'infix', + 'infixl', 'infixr', 'let', 'open', 'pattern', 'primitive', + 'private', 'mutual', 'quote', 'quoteGoal', 'quoteTerm', + 'record', 'syntax', 'rewrite', 'unquote', 'using', 'where', + 'with'] tokens = { 'root': [ @@ -1125,8 +1126,7 @@ class AgdaLexer(RegexLexer): # Lexemes: # Identifiers (ur'\b(%s)(?!\')\b' % '|'.join(reserved), Keyword.Reserved), - (r'(import)(\s+)([A-Z][a-zA-Z0-9_.]*)', bygroups(Keyword.Reserved, Text, Name)), - (r'(module)(\s+)([A-Z][a-zA-Z0-9_.]*)', bygroups(Keyword.Reserved, Text, Name)), + (r'(import|module)(\s+)', bygroups(Keyword.Reserved, Text), 'module'), (r'\b(Set|Prop)\b', Keyword.Type), # Special Symbols (r'(\(|\)|\{|\})', Operator), @@ -1156,6 +1156,11 @@ class AgdaLexer(RegexLexer): (r'!}', Comment.Directive, '#pop'), (r'[!{}]', Comment.Directive), ], + 'module': [ + (r'{-', Comment.Multiline, 'comment'), + (r'[a-zA-Z][a-zA-Z0-9_.]*', Name, '#pop'), + (r'[^a-zA-Z]*', Text) + ], 'character': HaskellLexer.tokens['character'], 'string': HaskellLexer.tokens['string'], 'escape': HaskellLexer.tokens['escape'] -- cgit v1.2.1 From 057a8da4c453d7507b2f879413c5de64b930391f Mon Sep 17 00:00:00 2001 From: Tim Baumann Date: Sun, 19 May 2013 22:32:57 +0200 Subject: Factored out LiterateLexer as a base class for both LiterateAgdaLexer and LiterateHaskellLexer. --- pygments/lexers/functional.py | 187 +++++++++++++++++++++--------------------- 1 file changed, 95 insertions(+), 92 deletions(-) (limited to 'pygments/lexers') diff --git a/pygments/lexers/functional.py b/pygments/lexers/functional.py index edd139c1..5a5097fa 100644 --- a/pygments/lexers/functional.py +++ b/pygments/lexers/functional.py @@ -22,6 +22,9 @@ __all__ = ['RacketLexer', 'SchemeLexer', 'CommonLispLexer', 'HaskellLexer', 'ElixirConsoleLexer', 'KokaLexer'] +line_re = re.compile('.*?\n') + + class RacketLexer(RegexLexer): """ Lexer for `Racket `_ source code (formerly known as @@ -1012,90 +1015,6 @@ class HaskellLexer(RegexLexer): } -line_re = re.compile('.*?\n') -bird_re = re.compile(r'(>[ \t]*)(.*\n)') - -# bird-style -def _bird_get_tokens_unprocessed(text, baselexer): - code = '' - insertions = [] - for match in line_re.finditer(text): - line = match.group() - m = bird_re.match(line) - if m: - insertions.append((len(code), - [(0, Comment.Special, m.group(1))])) - code += m.group(2) - else: - insertions.append((len(code), [(0, Text, line)])) - for item in do_insertions(insertions, baselexer.get_tokens_unprocessed(code)): - yield item - - -# latex-style -def _latex_get_tokens_unprocessed(text, baselexer, lxlexer): - code = '' - insertions = [] - - codelines = 0 - latex = '' - for match in line_re.finditer(text): - line = match.group() - if codelines: - if line.lstrip().startswith('\\end{code}'): - codelines = 0 - latex += line - else: - code += line - elif line.lstrip().startswith('\\begin{code}'): - codelines = 1 - latex += line - insertions.append((len(code), - list(lxlexer.get_tokens_unprocessed(latex)))) - latex = '' - else: - latex += line - insertions.append((len(code), - list(lxlexer.get_tokens_unprocessed(latex)))) - for item in do_insertions(insertions, baselexer.get_tokens_unprocessed(code)): - yield item - - -class LiterateHaskellLexer(Lexer): - """ - For Literate Haskell (Bird-style or LaTeX) source. - - Additional options accepted: - - `litstyle` - If given, must be ``"bird"`` or ``"latex"``. If not given, the style - is autodetected: if the first non-whitespace character in the source - is a backslash or percent character, LaTeX is assumed, else Bird. - - *New in Pygments 0.9.* - """ - name = 'Literate Haskell' - aliases = ['lhs', 'literate-haskell'] - filenames = ['*.lhs'] - mimetypes = ['text/x-literate-haskell'] - - def get_tokens_unprocessed(self, text): - hslexer = HaskellLexer(**self.options) - - style = self.options.get('litstyle') - if style is None: - style = (text.lstrip()[0:1] in '%\\') and 'latex' or 'bird' - - if style == 'bird': - for item in _bird_get_tokens_unprocessed(text, hslexer): - yield item - else: - from pygments.lexers.text import TexLexer - lxlexer = TexLexer(**self.options) - for item in _latex_get_tokens_unprocessed(text, hslexer, lxlexer): - yield item - - class AgdaLexer(RegexLexer): """ For the `Agda `_ @@ -1167,7 +1086,95 @@ class AgdaLexer(RegexLexer): } -class LiterateAgdaLexer(Lexer): +class LiterateLexer(Lexer): + """ + Base class for lexers of literate file formats based on LaTeX or Bird-style + (prefixing each code line with ">"). + + Additional options accepted: + + `litstyle` + If given, must be ``"bird"`` or ``"latex"``. If not given, the style + is autodetected: if the first non-whitespace character in the source + is a backslash or percent character, LaTeX is assumed, else Bird. + """ + + bird_re = re.compile(r'(>[ \t]*)(.*\n)') + + def __init__(self, baselexer, **options): + self.baselexer = baselexer + Lexer.__init__(self, **options) + + def get_tokens_unprocessed(self, text): + style = self.options.get('litstyle') + if style is None: + style = (text.lstrip()[0:1] in '%\\') and 'latex' or 'bird' + + code = '' + insertions = [] + if style == 'bird': + # bird-style + for match in line_re.finditer(text): + line = match.group() + m = self.bird_re.match(line) + if m: + insertions.append((len(code), + [(0, Comment.Special, m.group(1))])) + code += m.group(2) + else: + insertions.append((len(code), [(0, Text, line)])) + else: + # latex-style + from pygments.lexers.text import TexLexer + lxlexer = TexLexer(**self.options) + codelines = 0 + latex = '' + for match in line_re.finditer(text): + line = match.group() + if codelines: + if line.lstrip().startswith('\\end{code}'): + codelines = 0 + latex += line + else: + code += line + elif line.lstrip().startswith('\\begin{code}'): + codelines = 1 + latex += line + insertions.append((len(code), + list(lxlexer.get_tokens_unprocessed(latex)))) + latex = '' + else: + latex += line + insertions.append((len(code), + list(lxlexer.get_tokens_unprocessed(latex)))) + for item in do_insertions(insertions, self.baselexer.get_tokens_unprocessed(code)): + yield item + + +class LiterateHaskellLexer(LiterateLexer): + """ + For Literate Haskell (Bird-style or LaTeX) source. + + Additional options accepted: + + `litstyle` + If given, must be ``"bird"`` or ``"latex"``. If not given, the style + is autodetected: if the first non-whitespace character in the source + is a backslash or percent character, LaTeX is assumed, else Bird. + + *New in Pygments 0.9.* + """ + name = 'Literate Haskell' + aliases = ['lhs', 'literate-haskell'] + filenames = ['*.lhs'] + mimetypes = ['text/x-literate-haskell'] + + def __init__(self, **options): + hslexer = HaskellLexer(**options) + LiterateLexer.__init__(self, hslexer, **options) + + +class LiterateAgdaLexer(LiterateLexer): """ For Literate Agda source. """ @@ -1176,13 +1183,9 @@ class LiterateAgdaLexer(Lexer): filenames = ['*.lagda'] mimetypes = ['text/x-literate-agda'] - def get_tokens_unprocessed(self, text): - agdalexer = AgdaLexer(**self.options) - - from pygments.lexers.text import TexLexer - lxlexer = TexLexer(**self.options) - for item in _latex_get_tokens_unprocessed(text, agdalexer, lxlexer): - yield item + def __init__(self, **options): + agdalexer = AgdaLexer(**options) + LiterateLexer.__init__(self, agdalexer, litstyle='latex', **options) class SMLLexer(RegexLexer): -- cgit v1.2.1 From ac957840bdb18b1d4fb8202228cae6b00dd23a52 Mon Sep 17 00:00:00 2001 From: Tim Baumann Date: Sun, 19 May 2013 22:55:49 +0200 Subject: Cosmetic changes in Agda lexer --- pygments/lexers/functional.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'pygments/lexers') diff --git a/pygments/lexers/functional.py b/pygments/lexers/functional.py index 5a5097fa..b9016835 100644 --- a/pygments/lexers/functional.py +++ b/pygments/lexers/functional.py @@ -16,9 +16,9 @@ from pygments.token import Text, Comment, Operator, Keyword, Name, \ String, Number, Punctuation, Literal, Generic, Error __all__ = ['RacketLexer', 'SchemeLexer', 'CommonLispLexer', 'HaskellLexer', - 'LiterateHaskellLexer', 'AgdaLexer', 'LiterateAgdaLexer', + 'AgdaLexer', 'LiterateHaskellLexer', 'LiterateAgdaLexer', 'SMLLexer', 'OcamlLexer', 'ErlangLexer', 'ErlangShellLexer', - 'OpaLexer', 'CoqLexer', 'AgdaLexer', 'NewLispLexer', 'ElixirLexer', + 'OpaLexer', 'CoqLexer', 'NewLispLexer', 'ElixirLexer', 'ElixirConsoleLexer', 'KokaLexer'] @@ -1036,7 +1036,8 @@ class AgdaLexer(RegexLexer): tokens = { 'root': [ # Declaration - (r'^(\s*)([^\s\(\)\{\}]+)(\s*)(:)(\s*)', bygroups(Text, Name.Function, Text, Operator.Word, Text)), + (r'^(\s*)([^\s\(\)\{\}]+)(\s*)(:)(\s*)', + bygroups(Text, Name.Function, Text, Operator.Word, Text)), # Comments (r'--(?![!#$%&*+./<=>?@\^|_~:\\]).*?$', Comment.Single), (r'{-', Comment.Multiline, 'comment'), -- cgit v1.2.1