Gettext Message Catalogs Lexer

Issue #266 resolved
Former user created an issue

Here's a custom Gettext Message Catalogs Lexer.

I'm sure that there might be some bad usage, but it was a trial and error work, just hope it helps others. {{{


import re from pygments.lexer import RegexLexer, bygroups from pygments.token import *

class GettextLexer(RegexLexer): name = 'Gettext Catalog' aliases = ['pot', 'po'] filenames = ['.pot', '.po'] mimetypes = ['application/x-gettext', 'text/x-gettext', 'text/gettext']

tokens = {
    'root': [
        (r'^#,\\s.*?$', Keyword.Type),
        (r'^#:\\s.*?$', Keyword.Declaration),
        #(r'^#$', Comment),
        (r'^(#|#\\.\\s|#\\|\\s|#~\\s|#\\s).*$', Comment.Single),
         bygroups(String, Name.Property, String)),
        (r'^".*"$', String),
         bygroups(Name.Variable, Text, String)),
         bygroups(Name.Variable, Number.Integer, Name.Variable, Text, String)),


Reported by guest

Comments (4)

  1. Log in to comment