% This file contains some restricted keywords for highlighting the all the
% snippets in LaTeX.  The main purpose is to easy reading the Scheme
% Domain-Specific code by coloring what is Guile-specific, user-specific and DSL-specific.
%
% The language shell is also trivially defined.

\usepackage{listings}
\usepackage{color}

\definecolor{someguile}{rgb}{0.0, 0.25, 0.8}
\definecolor{somestring}{rgb}{0.8, 0.25, 0.0}
\definecolor{somevariable}{rgb}{0.0, 0.5, 0.0}
\definecolor{somecomment}{rgb}{1.0, 0.0, 0}
\definecolor{bracket}{rgb}{0.6, 0.6, 0.6}

\lstdefinelanguage{Scheme}{
    basicstyle=\normalsize\ttfamily\slshape\color{somevariable},
    sensitive=true,
    alsoletter={-,\#,:,>},
    morestring = [b]",
    stringstyle=\upshape\color{somestring},
    morecomment=[l]{;},
    commentstyle=\upshape\color{somecomment},
    literate=
            *{(}{{\textcolor{bracket}{(}}}{1}
            {)}{{\textcolor{bracket}{)}}}{1},
    classoffset=0,
    % Guile
    morekeywords={
        define, define-public,
        list, map, compose,
        cons,
        lambda,
        let, let*, quote,
        append, string-append,
        use-modules, define-module, \#:use-module, \#:prefix
        },
    keywordstyle=\ttfamily\upshape\color{someguile},
    classoffset=1,
    % Fix
    morekeywords={
        guix, transformations,
        gnu, srfi, srfi-1,
        desktop, mcron, networking, xorg,
        certs, fonts,
        font-bitstream-vera, nss-certs,
        xfce-desktop-service-type,
        cron-jobs, mcron-service-type,
        dhcp-client-service-type,
    },
    keywordstyle=\ttfamily\upshape\color{black},
    classoffset=1,
    % DSL
    morekeywords={
    package,
    name, version,
    build-system, gnu-build-system, arguments,
    inputs,
    synopsis, description, license,
    source, origin,
    method, url-fetch, git-fetch,
    specifications->manifest, specification->package, packages->manifest,
    options->transformation, with-c-toolchain,
    },
    % DSL VM
    morekeywords={
    use-service-modules, use-package-modules,
    operating-system,
    host-name, timezone, locale, keyboard-layout, label, firmware,
    bootloader, bootloader-configuration, grub-bootloader, targets, terminal-outputs,
    users, user-account, name, password, group, supplementary-groups,
    file-systems, file-system, mount-point, device, type,
    base-file-systems,          % bug with %base-
    base-user-accounts,
    base-packages,
    packages,
    services, service, simple-service,
    plain-file,
    },
    keywordstyle=\ttfamily\bfseries\upshape\color{black},
    classoffset=0,
}

\lstdefinelanguage{shell}{
    basicstyle=\normalsize\ttfamily,
    sensitive=true,
    morestring = [b]",
    stringstyle=\upshape\color{red},
    morecomment=[l]{\#},
    commentstyle=\upshape\color{green},
}

% \lstdefinelanguage{text}{
%     basicstyle=\normalsize\ttfamily,
%     sensitive=true,
%     commentstyle=\upshape\color{green},
% }
