2022-01-24 12:07:52 +08:00
|
|
|
"""
|
|
|
|
pygments.lexers.procfile
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Lexer for Procfile file format.
|
|
|
|
|
2024-03-04 01:15:23 +08:00
|
|
|
:copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
|
2022-01-24 12:07:52 +08:00
|
|
|
: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.
|
|
|
|
|
|
|
|
.. versionadded:: 2.10
|
|
|
|
"""
|
|
|
|
name = 'Procfile'
|
2022-11-08 02:06:49 +08:00
|
|
|
url = 'https://devcenter.heroku.com/articles/procfile#procfile-format'
|
2022-01-24 12:07:52 +08:00
|
|
|
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),
|
|
|
|
],
|
|
|
|
}
|