Skip to content
Elliot Shank edited this page Apr 12, 2017 · 14 revisions

The v1 grammar

This grammar overcomes most limitations in the v0 grammar, most particularly handling of quoting and escaping values. Beyond quoting issues, the primary difference from the v0 grammar is that command statements must be terminated by the "end" keyword in order to allow specifying that things should not go through the shell.

This grammar does not support include-file. You need to use the v2 grammar for that.

Triggering

To declare that a particular package definition file should be parsed in this format, use a grammar statement:

grammar v1

Note that, if there is no grammar statement in a file, then the v0 grammar will be used.

Simplified representation

A quick summary of the v1 grammar (see the details for each statement for full syntax):

# Shell/Awk/Perl/Ruby/etc.-like comments
#
# Newlines are not treated differently from any other whitespace other than
# for terminating comments.  For a file that contains no comments, all
# newlines could be substituted with space characters and Fig will parse it
# identically.

# Order of statements at the file level is NOT significant, except for the
# grammar statement, which has to be the first statement in a file and
# cannot appear anywhere other than as the first statement.

# If the grammar statement is not present, then the v0 grammar is assumed.
grammar v1

resource [path | URL]
archive  [path | URL]

retrieve VARIABLE->relative/path/to/directory

config name
    # Order of statements within a config IS significant (except for
    # overrides and the command statement).
    set VARIABLE=value
    add VARIABLE=value
    override package/version
    include package/version:config

    command
        echo "some command" 'to run'
    end
end

The package/version:config in the include and package/version in the override above are package descriptors.

Comments

Comments start with an octothorpe ("#") and end at the next newline. Octothorpes can be included in a value by quoting them.

grammar v1
resource "foo#bar"

config default
    set foo='bar#baz'
end
Clone this wiki locally