guix/src/libexpr
Eelco Dolstra 6d6c68c0d2 * Added a new kind of multi-line string literal delimited by two
single quotes.  Example (from NixOS):

    job = ''
      start on network-interfaces

      start script

        rm -f /var/run/opengl-driver
        ${if videoDriver == "nvidia"        
          then "ln -sf ${nvidiaDrivers} /var/run/opengl-driver"
          else if cfg.driSupport
          then "ln -sf ${mesa} /var/run/opengl-driver"
          else ""
        }

        rm -f /var/log/slim.log

      end script
    '';

  This style has two big advantages:

  - \, ' and " aren't special, only '' and ${.  So you get a lot less
    escaping in shell scripts / configuration files in Nixpkgs/NixOS.
    The delimiter '' is rare in scripts (and can usually be written as
    "").  ${ is also fairly rare.

    Other delimiters such as <<...>>, {{...}} and <|...|> were also
    considered but this one appears to have the fewest drawbacks
    (thanks Martin).

  - Indentation is intelligently stripped so that multi-line strings
    can follow the nesting structure of the containing Nix
    expression.  E.g. in the example above 6 spaces are stripped from
    the start of each line.  This prevents unnecessary indentation in
    generated files (which sometimes even breaks things).

  See tests/lang/eval-okay-ind-string.nix for some examples.
2007-11-30 16:48:45 +00:00
..
Makefile.am * Option --argstr for passing string arguments easily. (NIX-75) 2007-01-14 12:32:44 +00:00
attr-path.cc * Cleanup. 2007-01-13 14:21:49 +00:00
attr-path.hh * Use a proper namespace. 2006-09-04 21:06:23 +00:00
common-opts.cc * Option --argstr for passing string arguments easily. (NIX-75) 2007-01-14 12:32:44 +00:00
common-opts.hh * Option --argstr for passing string arguments easily. (NIX-75) 2007-01-14 12:32:44 +00:00
eval.cc * New builtin function "isFunction". You're not supposed to use it 2007-05-16 16:17:04 +00:00
eval.hh * Memoize strict evaluation. 2007-01-13 15:41:54 +00:00
expr-to-xml.cc * printTermAsXML: treat derivations specially; emit an element 2007-01-13 15:11:10 +00:00
expr-to-xml.hh * Big cleanup of the semantics of paths, strings, contexts, string 2006-10-16 15:55:34 +00:00
get-drvs.cc * nix-env: allow ~/.nix-defexpr to be a directory. If it is, then the 2007-09-17 16:08:24 +00:00
get-drvs.hh * nix-env -i: instead of breaking package ties by version, break them 2007-05-01 20:33:18 +00:00
lexer.l * Added a new kind of multi-line string literal delimited by two 2007-11-30 16:48:45 +00:00
nix.sdf * Support `++'. 2006-09-11 13:05:15 +00:00
nixexpr-ast.def * Added a new kind of multi-line string literal delimited by two 2007-11-30 16:48:45 +00:00
nixexpr.cc * nix-env now maintains meta info (from the `meta' derivation 2007-02-02 01:52:42 +00:00
nixexpr.hh * New primop "throw <string>" to throw an error. This is like abort, 2007-04-16 15:03:19 +00:00
parser.hh * Use a proper namespace. 2006-09-04 21:06:23 +00:00
parser.y * Added a new kind of multi-line string literal delimited by two 2007-11-30 16:48:45 +00:00
primops.cc * New primop `readFile' to get the contents of a file as a string. 2007-11-21 13:49:59 +00:00