More edits.
1 parent a8b6840 commit 5f97d0c7ee7a5873da23a010134bcc8b550806c0
@tundra tundra authored on 1 Jul 2003
Showing 1 changed file
View
120
tconfpy-spec.txt
$Id: tconfpy-spec.txt,v 1.1 2003/07/01 19:46:31 tundra Exp $
$Id: tconfpy-spec.txt,v 1.100 2003/07/01 20:20:08 tundra Exp $
 
tconfpy SPECIFICATION
=====================
 
"StrOpts" : [sopt, sopt, ...]
}
 
bopt = [name, default]
For each of these these types of entries,
'Configurable' is a boolean which must be True for
the Option to be settable in the Configuration File.
If Configurable == False, then the option is set to
its default value during initial parsing and may not
be changed further in the Configuration File.
 
nopt = [name, default, [min, max]]
Similarly, NumVals sets how many values may
be associated with that option. A value of
0 means there is no limit.
 
bopt = [name, default, Configurable, NumVals=1]
 
A bopt can only be True/False
 
nopt = [name, default, Configurable, NumVals, [min, max]]
 
If min or max are None, then no bound in that
direction is enforced. For no bounds checking,
use [None, None] or [].
 
sopt = [name, default, [list of legal vals - regex]]
sopt = [name, default, Configurable, NumVals, [list of legal vals - regex]]
 
Each entry in the list of legal vals may be a
literal string or a regular expression. If the
list of legal vals is [], it means there are no
FatalError ---> If True, means parsing failed pathologically, and
pgm should not continue
 
 
------------------------------------------------------------------------------
 
 
CONFIGURATION LANGUAGE
======================
 
continuation support. Case is significant unless the
IgnoreCase option is invoked when calling the Parsing API.
 
 
Variable Names & Dereferencing
------------------------------
Variable Naming & Dereferencing
-------------------------------
 
Variables names may be arbitrary length and contain any printable
Variable names may be arbitrary length and contain any printable
character except '$', '=', or '#'.
 
Variables must be defined before being referenced. No forward
references are permitted. Variables named in the Options list are
considered predefined and are intialized to their default values.
Environment Variables are also considered predefined with values as
set in the invoking environment.
references are permitted. Variables named in the Options list passed
into the Parsing API are considered predefined and are intitialized to
their default values. Environment Variables are also considered
predefined with values as set in the invoking environment.
 
A variable is dereferenced by enclosing it in square brackets:
 
 
.if REF # Existential
.endif # Conditional block delimiter
 
 
Assignment
----------
 
General idea is to associate a symbol name with a list of one or
more values. Each value in the list is delimited with the
equal symbol ('='). Any symbol which appears as a predfined
Option passed into the parsing API may only have one value
associated with it AND that value must conform to the
set of legal values defined for that variable in the associated
Options entry.
Configuration Variables
=======================
 
The heart of tconfpy is the association of one or more values with
so-called "Configuration Variables". These variables and their values
are returned in the Symbol Table constructed by the parser.
 
 
User-Defined Configuration Variables
------------------------------------
 
Users may define their own configuration variables and associate one
or more values with that variable. The general idea is to associate a
symbol name with a list of one or more values. Each value in the list
is delimited with the equal symbol ('=').
 
x = y = z ...
 
This means the Symbol Table will return an entry in this form:
This means, after parsing, the Symbol Table will contain an entry in this form:
 
{'x' : ['y', 'z', ...]}
 
 
 
Pre-Defined Option Variables
----------------------------
 
Pre-Defined Option Variables (one of the entries in the Options passed into the
Parsing API) are similar to User-Defined Variables but with more rigid
restrictions:
 
- An option has a fixed number of possible values assigned to it. This
is set by the NumVals field in that option in the Options data structure.
 
Say, and 'opt1' has NumVals set to 2, then this would not be a legal
config statement:
 
opt1 = val1 = val2 = val3
 
- Boolean Options always are limited to a single value (True or False)
(NumVal = 1). The Right-Hand Side of a Boolean option assignment
may be the string "True" or "False" in any case regardless of the
IgnoreCase setting passed to the Parsing API.
 
- Numeric and String Options may have as many values associated with
them as their associated NumVals entry permits. Each such value
must conform to either the min/max criteria (for Numerics) or
the literal/regex criteria (for Strings) in their associated
Options entry.