diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2013-05-12 19:30:55 -0700 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2013-05-12 19:30:55 -0700 |
commit | b2f78ef78ebf926605a3fcf194b72f405b16a8b0 (patch) | |
tree | 6cc5253619c4b13d5ca3f64a2ccf3e248cac196c /lib | |
parent | b2a5fef6ad11c9f975d3ddb4a6e34b03bb8051f5 (diff) | |
download | spack-b2f78ef78ebf926605a3fcf194b72f405b16a8b0.tar.gz spack-b2f78ef78ebf926605a3fcf194b72f405b16a8b0.tar.bz2 spack-b2f78ef78ebf926605a3fcf194b72f405b16a8b0.tar.xz spack-b2f78ef78ebf926605a3fcf194b72f405b16a8b0.zip |
Added EBNF grammar.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/spec.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index 853e7238d8..86cab3430c 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -36,6 +36,28 @@ line is a spec for a particular installation of the mpileaks package. A version list denoted by '@' is associated with the compiler only if if it comes immediately after the compiler name. Otherwise it will be associated with the current package spec. + +Here is the EBNF grammar for a spec: + + spec-list = { spec [ dep-list ] } + dep_list = { ^ spec } + spec = id [ options ] + options = { @version-list | +variant | -variant | ~variant | %compiler } + variant = id + compiler = id [ version-list ] + version-list = version [ { , version } ] + version = id | id: | :id | id:id + id = [A-Za-z0-9_][A-Za-z0-9_.-]* + +There is one context-sensitive part: ids in versions may contain '.', while +other ids may not. + +There is one ambiguity: since '-' is allowed in an id, you need to put +whitespace space before -variant for it to be tokenized properly. You can +either use whitespace, or you can just use ~variant since it means the same +thing. Spack uses ~variant in directory names and in the canonical form of +specs to avoid ambiguity. Both are provided because ~ can cause shell +expansion when it is the first character in an id typed on the command line. """ from functools import total_ordering |