Coverage for pygments.lexers.nix : 89%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# -*- coding: utf-8 -*- pygments.lexers.nix ~~~~~~~~~~~~~~~~~~~
Lexers for the NixOS Nix language.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """
Number, Punctuation, Literal
""" For the `Nix language <http://nixos.org/nix/>`_.
.. versionadded:: 2.0 """
'else', 'then', '...'] 'map', 'removeAttrs', 'throw', 'toString', 'derivation'] '!=', '&&', '||', '->', '=']
'root': [ # comments starting with # (r'#.*$', Comment.Single),
# multiline comments (r'/\*', Comment.Multiline, 'comment'),
# whitespace (r'\s+', Text),
# keywords ('(%s)' % '|'.join(re.escape(entry) + '\\b' for entry in keywords), Keyword),
# highlight the builtins ('(%s)' % '|'.join(re.escape(entry) + '\\b' for entry in builtins), Name.Builtin),
(r'\b(true|false|null)\b', Name.Constant),
# operators ('(%s)' % '|'.join(re.escape(entry) for entry in operators), Operator),
# word operators (r'\b(or|and)\b', Operator.Word),
# punctuations ('(%s)' % '|'.join(re.escape(entry) for entry in punctuations), Punctuation),
# integers (r'[0-9]+', Number.Integer),
# strings (r'"', String.Double, 'doublequote'), (r"''", String.Single, 'singlequote'),
# paths (r'[\w.+-]*(\/[\w.+-]+)+', Literal), (r'\<[\w.+-]+(\/[\w.+-]+)*\>', Literal),
# urls (r'[a-zA-Z][a-zA-Z0-9\+\-\.]*\:[\w%/?:@&=+$,\\.!~*\'-]+', Literal),
# names of variables (r'[\w-]+\s*=', String.Symbol), (r'[a-zA-Z_][\w\'-]*', Text),
], 'comment': [ (r'[^/*]+', Comment.Multiline), (r'/\*', Comment.Multiline, '#push'), (r'\*/', Comment.Multiline, '#pop'), (r'[*/]', Comment.Multiline), ], 'singlequote': [ (r"'''", String.Escape), (r"''\$\{", String.Escape), (r"''\n", String.Escape), (r"''\r", String.Escape), (r"''\t", String.Escape), (r"''", String.Single, '#pop'), (r'\$\{', String.Interpol, 'antiquote'), (r"[^']", String.Single), ], 'doublequote': [ (r'\\', String.Escape), (r'\\"', String.Escape), (r'\\$\{', String.Escape), (r'"', String.Double, '#pop'), (r'\$\{', String.Interpol, 'antiquote'), (r'[^"]', String.Double), ], 'antiquote': [ (r"\}", String.Interpol, '#pop'), # TODO: we should probably escape also here ''${ \${ (r"\$\{", String.Interpol, '#push'), include('root'), ], }
# TODO: let/in rv += 0.4 rv += 0.4 rv += 0.1 |