aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/Pygments/py3/pygments/lexers/procfile.py
blob: 9856f919a46ac7b80944c1fac896c32debcec596 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
""" 
    pygments.lexers.procfile 
    ~~~~~~~~~~~~~~~~~~~~~~~~ 
 
    Lexer for Procfile file format. 
 
    :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. 
    :license: BSD, see LICENSE for details. 
""" 
 
from pygments.lexer import RegexLexer, bygroups 
from pygments.token import Name, Number, String, Text, Punctuation 
 
__all__ = ["ProcfileLexer"] 
 
 
class ProcfileLexer(RegexLexer): 
    """ 
    Lexer for Procfile file format. 
 
    The format is used to run processes on Heroku or is used by Foreman or 
    Honcho tools. 
    For more information about the definition of the format, see: 
    https://devcenter.heroku.com/articles/procfile#procfile-format 
 
    .. versionadded:: 2.10 
    """ 
    name = 'Procfile' 
    aliases = ['procfile'] 
    filenames = ['Procfile'] 
 
    tokens = { 
        'root': [ 
            (r'^([a-z]+)(:)', bygroups(Name.Label, Punctuation)), 
            (r'\s+', Text.Whitespace), 
            (r'"[^"]*"', String), 
            (r"'[^']*'", String), 
            (r'[0-9]+', Number.Integer), 
            (r'\$[a-zA-Z_][\w]*', Name.Variable), 
            (r'(\w+)(=)(\w+)', bygroups(Name.Variable, Punctuation, String)), 
            (r'([\w\-\./]+)', Text), 
        ], 
    }