Skip to content
Elliot Shank edited this page May 16, 2018 · 1 revision

The v0 grammar

This matches the original grammar for Fig. It has a number of limitations addressed in the v1 grammar. In particular, no values for anything can contain an octothorpe ("#") and, except for command statements, values cannot contain whitespace.

Triggering

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

grammar v0

Note that, if there is no grammar statement, then this syntax is assumed.

Simplified representation

A quick summary of the v0 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 v0

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

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

Comments

In v0, comments are anything between an octothorpe ("#") and newline. There is no way to include an octothorpe in any value, including via escaping. Thus, the following is syntactically invalid:

grammar v0
config name
    command "echo foo \# bar"
end
Clone this wiki locally