diff --git a/tconfpy.3 b/tconfpy.3 index 92b18bb..dd64d3b 100644 --- a/tconfpy.3 +++ b/tconfpy.3 @@ -724,10 +724,126 @@ This section of the document describes that language and provides examples of how each feature can be used. -.SS General Rules For The \*(TC Configuration Language +.SS \*(TC Configuration Language Syntax + +\*(TC supports a fairly simple and direct configuration +language syntax: + + +.IP \(bu 4 +Each line is treated independently. There is no line +"continuation". + +.IP \(bu 4 +The \'#'\ can begin a comment anywhere on a line. This is done +blindly. If you need to embed this symbol somewhere within a variable +value, use the \'[HASH]\' variable reference. + +.IP \(bu 4 +Whitespace is (mostly) insignificant. Leading and trailing +whitespace is ignored, as is whitespace around comparison +operators. However, there are some places where +whitespace matters: + +.nf + - Variable names may not contain whitespace + + - Directives must be followed by whitespace if + they take other arguments. + + - When assigning a value to a string variable, + whitespace within the value on the right-hand-side + is preserved. Leading- and trailing whitespace + around the right-hand-side of the assignment is + ignored. +.fi + +.IP \(bu 4 +Case is always significant except when assigning a value to Booleans +(described in the previous section). + +.IP \(bu 4 +Regardless of a variable's type, all variable references +return +.B a string representation of the variable's value! +This is done so that the variable's value can be used for +comparison testing and string substitution/concatenation. +In other words, variables are stored in their native type +in the symbol table that is returned to the calling program, +but they are treated as strings throughout the configuration +file. + + .SS Variables And Variable References +The heart of a configuration file is a "variable". Variables are +stored in a "Symbol Table" which is returned to the calling program +once the configuration file has been processed. The calling program +can pre-define any variables it wishes before processing a +configuration file. You can normally also define your own new +variables in the configuration file as desired (unless the programmer +has inhibited new variable creation). + +Variables are assigned values like this: + +.nf +MyVariable = Some string of text +.fi + +If \'MyVariable\' is a new variable, \*(TC will create it on the spot. +If it already exists, \*(TC will first check and make sure that +\'Some string of text\' is a legal value for this variable. +If not, it will produce an error and refuse to change the current +value of \'MyVariable\' + +You can get the value of any currently defined variable by +"referencing" it like this: + +.nf + .... [MyVariable] ... +.fi + +The brackets surrounding any name are what indicate that you want that +variable's value. + +You can also get the value of any Environment Variable on your +system by naming the variable with a leading \'$\': + +.nf + ... [$USER] ... # Gets the value of the USER environment variable +.fi + +However you cannot set the value of an environment variable: + +.nf +$USER = me # This is not permitted +.fi + +Variables can be named pretty much anything you like, with certain +restrictions: + +.IP \(bu 4 +Variable names may not contain whitespace. + +.IP \(bu 4 +Variable names may not begin with \'$\'. The one exception +to this is when you are referencing the value of an environment +variable as just described. + +.IP \(bu 4 +Variable names cannot have the \'#\' character anywhere in them +because \*(TC sees that character as the beginning a comment. + +.IP \(bu 4 +You cannot have a variable with no name. This is illegal: + +.nf + = String +.fi + + + .SS Predefined Variables .SS The \'.include\' Directive