"This module provides Pygments lexers for the Maude language and its interactive environment." from pygments.lexer import RegexLexer, words, bygroups, using from pygments.token import * class MaudeLexer(RegexLexer): "A Pygments lexer for the Maude language." name = 'Maude' aliases = ['maude'] filenames = ['*.maude'] mimetypes = ['text/x-maude'] tokens = { 'root': [ (r'\*\*\*\(', Comment.Multiline, 'multiline-comment'), (r'(?:\*\*\*|---).*?$', Comment.Single), (r'"(\\\\|\\"|[^"])*"', String.Double), (r'\s+', Whitespace), (words([ ",", "(", ")", "[", "]", "{", "}", ], prefix=r'(?:(?", ":", ":=", "*", "/\\", "+", "<", "<=?", "=?", "=", "=>", "~>", ], prefix=r'(?:(?<=[\s,\(\)\[\]\{\}])|^)', suffix=r'(?:(?=[\s,\(\)\[\]\{\}])|$)'), Operator), (r'[+-]?[0-9]+', Number.Integer), (r'[^\s,\(\)\[\]\{\}]+', Name), ], 'multiline-comment': [ (r'[^\(\)]+', Comment.Multiline), (r'\(', Comment.Multiline, '#push'), (r'\)', Comment.Multiline, '#pop'), ], } class MaudeLogLexer(RegexLexer): "A Pygments lexer for Maude interaction logs." name = 'MaudeLog' aliases = ['maude-log'] filenames = ['*.maude-log'] alias_filenames = ['*.txt', '*.log'] mimetypes = ['text/plain'] tokens = { 'root': [ (r'^((?:Maude)?>)(.*?)$', bygroups(Generic.Prompt, using(MaudeLexer))), (r'^.+?$', Generic.Output), ], }