procfile.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. """
  2. pygments.lexers.procfile
  3. ~~~~~~~~~~~~~~~~~~~~~~~~
  4. Lexer for Procfile file format.
  5. :copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS.
  6. :license: BSD, see LICENSE for details.
  7. """
  8. from pygments.lexer import RegexLexer, bygroups
  9. from pygments.token import Name, Number, String, Text, Punctuation
  10. __all__ = ["ProcfileLexer"]
  11. class ProcfileLexer(RegexLexer):
  12. """
  13. Lexer for Procfile file format.
  14. The format is used to run processes on Heroku or is used by Foreman or
  15. Honcho tools.
  16. """
  17. name = 'Procfile'
  18. url = 'https://devcenter.heroku.com/articles/procfile#procfile-format'
  19. aliases = ['procfile']
  20. filenames = ['Procfile']
  21. version_added = '2.10'
  22. tokens = {
  23. 'root': [
  24. (r'^([a-z]+)(:)', bygroups(Name.Label, Punctuation)),
  25. (r'\s+', Text.Whitespace),
  26. (r'"[^"]*"', String),
  27. (r"'[^']*'", String),
  28. (r'[0-9]+', Number.Integer),
  29. (r'\$[a-zA-Z_][\w]*', Name.Variable),
  30. (r'(\w+)(=)(\w+)', bygroups(Name.Variable, Punctuation, String)),
  31. (r'([\w\-\./]+)', Text),
  32. ],
  33. }