diff options
Diffstat (limited to 'tcllib/modules/pt/include/export/config')
12 files changed, 620 insertions, 0 deletions
diff --git a/tcllib/modules/pt/include/export/config/container.inc b/tcllib/modules/pt/include/export/config/container.inc new file mode 100644 index 0000000..13b89b1 --- /dev/null +++ b/tcllib/modules/pt/include/export/config/container.inc @@ -0,0 +1,78 @@ + +[section Configuration] + +The CONTAINER export plugin recognizes the following configuration +variables and changes its behaviour as they specify. + +[list_begin arguments] +[arg_def enum mode] + +The value of this configuration variable controls which methods of +[package pt::peg] instances the plugin will use to specify the +grammar. There are two legal values + +[list_begin definitions] +[def [const bulk]] + +In this mode the methods [method start], [method add], [method modes], +and [method rules] are used to specify the grammar in a bulk manner, +i.e. as a set of nonterminal symbols, and two dictionaries mapping +from the symbols to their semantic modes and parsing expressions. + +[para] + +This mode is the default. + +[def [const incremental]] + +In this mode the methods [method start], [method add], [method mode], +and [method rule] are used to specify the grammar piecemal, with each +nonterminal having its own block of defining commands. + +[list_end] + +[arg_def string template] + +If this configuration variable is set it is assumed to contain a +string into which to put the generated code and other configuration +data. The various locations are expected to be specified with the +following placeholders: + +[list_begin definitions] + +[def [const @user@]] +To be replaced with the value of the configuration variable [option user]. + +[def [const @format@]] +To be replaced with the the constant [const CONTAINER]. + +[def [const @file@]] +To be replaced with the value of the configuration variable [option file]. + +[def [const @name@]] +To be replaced with the value of the configuration variable [option name]. + +[def [const @mode@]] +To be replaced with the value of the configuration variable [option mode]. + +[def [const @code@]] +To be replaced with the generated code. + +[list_end] + +[para] + +If this configuration variable is not set, or empty, then the plugin +falls back to a standard template, which is defined as "[const @code@]". + +[list_end] + +[emph Note] that this plugin may ignore the standard configuration +variables [var user], [var format], [var file], and their values, +depending on the chosen template. + +[para] + +The content of the standard configuration variable [var name], if set, +is used as name of the grammar in the output. Otherwise the plugin +falls back to the default name [const a_pe_grammar]. diff --git a/tcllib/modules/pt/include/export/config/cparam.inc b/tcllib/modules/pt/include/export/config/cparam.inc new file mode 100644 index 0000000..afe817f --- /dev/null +++ b/tcllib/modules/pt/include/export/config/cparam.inc @@ -0,0 +1,80 @@ +[section Configuration] + +The C/PARAM export plugin recognizes the following configuration +variables and changes its behaviour as they specify. + +[list_begin arguments] + +[arg_def string template] + +If this configuration variable is set it is assumed to contain a +string into which to put the generated code and other configuration +data. The various locations are expected to be specified with the +following placeholders: + +[list_begin definitions] + +[def [const @user@]] +To be replaced with the value of the configuration variable [option user]. + +[def [const @format@]] +To be replaced with the the constant [const C/PARAM]. + +[def [const @file@]] +To be replaced with the value of the configuration variable [option file]. + +[def [const @name@]] +To be replaced with the value of the configuration variable [option name]. + +[def [const @code@]] +To be replaced with the generated C code. + +[list_end] + +The following configuration variables are special, in that they will +occur within the generated code, and are replaced there as well. + +[list_begin definitions] + +[def [const @statedecl@]] +To be replaced with the value of the configuration variable [option state-decl]. + +[def [const @stateref@]] +To be replaced with the value of the configuration variable [option state-ref]. + +[def [const @strings@]] +To be replaced with the value of the configuration variable [option string-varname]. + +[def [const @self@]] +To be replaced with the value of the configuration variable [option self-command]. + +[def [const @def@]] +To be replaced with the value of the configuration variable [option fun-qualifier]. + +[def [const @ns@]] +To be replaced with the value of the configuration variable [option namespace]. + +[def [const @main@]] +To be replaced with the value of the configuration variable [option main]. + +[def [const @prelude@]] +To be replaced with the value of the configuration variable [option prelude]. + +[list_end] + +[para] + +If this configuration variable is not set, or empty, then the plugin +falls back to a standard template, which is defined as "[const @code@]". + +[list_end] + +[emph Note] that this plugin may ignore the standard configuration +variables [var user], [var format], [var file], and their values, +depending on the chosen template. + +[para] + +The content of the standard configuration variable [var name], if set, +is used as name of the grammar in the output. Otherwise the plugin +falls back to the default name [const a_pe_grammar]. diff --git a/tcllib/modules/pt/include/export/config/json.inc b/tcllib/modules/pt/include/export/config/json.inc new file mode 100644 index 0000000..0b0053c --- /dev/null +++ b/tcllib/modules/pt/include/export/config/json.inc @@ -0,0 +1,36 @@ +[section Configuration] + +The JSON export plugin recognizes the following configuration +variables and changes its behaviour as they specify. + +[list_begin arguments] +[arg_def boolean indented] + +If this flag is set the plugin will break the generated JSON code +across lines and indent it according to its inner structure, with each +key of a dictionary on a separate line. + +[para] + +If this flag is not set (the default), the whole JSON object will be +written on a single line, with minimum spacing between all elements. + + +[arg_def boolean aligned] + +If this flag is set the generator ensures that the values for the keys +in a dictionary are vertically aligned with each other, for a nice +table effect. To make this work this also implies that [var indented] +is set. + +[para] + +If this flag is not set (the default), the output is formatted as per +the value of [var indented], without trying to align the values for +dictionary keys. + +[list_end] + +[emph Note] that this plugin ignores the standard configuration +variables [var user], [var format], [var file], and [var name], and +their values. diff --git a/tcllib/modules/pt/include/export/config/param.inc b/tcllib/modules/pt/include/export/config/param.inc new file mode 100644 index 0000000..2c3d911 --- /dev/null +++ b/tcllib/modules/pt/include/export/config/param.inc @@ -0,0 +1,49 @@ +[section Configuration] + +The PARAM export plugin recognizes the following configuration +variables and changes its behaviour as they specify. + +[list_begin arguments] + +[arg_def string template] + +If this configuration variable is set it is assumed to contain a +string into which to put the generated text and other configuration +data. The various locations are expected to be specified with the +following placeholders: + +[list_begin definitions] + +[def [const @user@]] +To be replaced with the value of the configuration variable [option user]. + +[def [const @format@]] +To be replaced with the the constant [const PARAM]. + +[def [const @file@]] +To be replaced with the value of the configuration variable [option file]. + +[def [const @name@]] +To be replaced with the value of the configuration variable [option name]. + +[def [const @code@]] +To be replaced with the generated text. + +[list_end] + +[para] + +If this configuration variable is not set, or empty, then the plugin +falls back to a standard template, which is defined as "[const @code@]". + +[list_end] + +[emph Note] that this plugin may ignore the standard configuration +variables [var user], [var format], [var file], and their values, +depending on the chosen template. + +[para] + +The content of the standard configuration variable [var name], if set, +is used as name of the grammar in the output. Otherwise the plugin +falls back to the default name [const a_pe_grammar]. diff --git a/tcllib/modules/pt/include/export/config/peg.inc b/tcllib/modules/pt/include/export/config/peg.inc new file mode 100644 index 0000000..9f50e5f --- /dev/null +++ b/tcllib/modules/pt/include/export/config/peg.inc @@ -0,0 +1,49 @@ +[section Configuration] + +The PEG export plugin recognizes the following configuration +variables and changes its behaviour as they specify. + +[list_begin arguments] + +[arg_def string template] + +If this configuration variable is set it is assumed to contain a +string into which to put the generated text and other configuration +data. The various locations are expected to be specified with the +following placeholders: + +[list_begin definitions] + +[def [const @user@]] +To be replaced with the value of the configuration variable [option user]. + +[def [const @format@]] +To be replaced with the the constant [const PEG]. + +[def [const @file@]] +To be replaced with the value of the configuration variable [option file]. + +[def [const @name@]] +To be replaced with the value of the configuration variable [option name]. + +[def [const @code@]] +To be replaced with the generated text. + +[list_end] + +[para] + +If this configuration variable is not set, or empty, then the plugin +falls back to a standard template, which is defined as "[const @code@]". + +[list_end] + +[emph Note] that this plugin may ignore the standard configuration +variables [var user], [var format], [var file], and their values, +depending on the chosen template. + +[para] + +The content of the standard configuration variable [var name], if set, +is used as name of the grammar in the output. Otherwise the plugin +falls back to the default name [const a_pe_grammar]. diff --git a/tcllib/modules/pt/include/export/config/tclparam.inc b/tcllib/modules/pt/include/export/config/tclparam.inc new file mode 100644 index 0000000..cec07e8 --- /dev/null +++ b/tcllib/modules/pt/include/export/config/tclparam.inc @@ -0,0 +1,74 @@ +[section Configuration] + +The Tcl/PARAM export plugin recognizes the following configuration +variables and changes its behaviour as they specify. + +[list_begin arguments] + +[arg_def string template] + +If this configuration variable is set it is assumed to contain a +string into which to put the generated code and other configuration +data. The various locations are expected to be specified with the +following placeholders: + +[list_begin definitions] + +[def [const @user@]] +To be replaced with the value of the configuration variable [option user]. + +[def [const @format@]] +To be replaced with the the constant [const Tcl/PARAM]. + +[def [const @file@]] +To be replaced with the value of the configuration variable [option file]. + +[def [const @name@]] +To be replaced with the value of the configuration variable [option name]. + +[def [const @code@]] +To be replaced with the generated Tcl code. + +[list_end] + +The following configuration variables are special, in that they will +occur within the generated code, and are replaced there as well. + +[list_begin definitions] + +[def [const @runtime@]] +To be replaced with the value of the configuration variable [option runtime-command]. + +[def [const @self@]] +To be replaced with the value of the configuration variable [option self-command]. + +[def [const @def@]] +To be replaced with the value of the configuration variable [option proc-command]. + +[def [const @ns@]] +To be replaced with the value of the configuration variable [option namespace]. + +[def [const @main@]] +To be replaced with the value of the configuration variable [option main]. + +[def [const @prelude@]] +To be replaced with the value of the configuration variable [option prelude]. + +[list_end] + +[para] + +If this configuration variable is not set, or empty, then the plugin +falls back to a standard template, which is defined as "[const @code@]". + +[list_end] + +[emph Note] that this plugin may ignore the standard configuration +variables [var user], [var format], [var file], and their values, +depending on the chosen template. + +[para] + +The content of the standard configuration variable [var name], if set, +is used as name of the grammar in the output. Otherwise the plugin +falls back to the default name [const a_pe_grammar]. diff --git a/tcllib/modules/pt/include/export/config/to_container.inc b/tcllib/modules/pt/include/export/config/to_container.inc new file mode 100644 index 0000000..d6a32a6 --- /dev/null +++ b/tcllib/modules/pt/include/export/config/to_container.inc @@ -0,0 +1,7 @@ + +[section "[vset TPREFIX]Options"] + +The converter to the CONTAINER format recognizes the following options +and changes its behaviour as they specify. + +[include ../../format/options_container.inc] diff --git a/tcllib/modules/pt/include/export/config/to_cparam.inc b/tcllib/modules/pt/include/export/config/to_cparam.inc new file mode 100644 index 0000000..7955732 --- /dev/null +++ b/tcllib/modules/pt/include/export/config/to_cparam.inc @@ -0,0 +1,25 @@ + +[section Options] + +The converter to C code recognizes the following configuration +variables and changes its behaviour as they specify. + +[include ../../format/options_cparam_rawc.inc] + +While the high parameterizability of this converter, as shown by the +multitude of options it supports, is an advantage to the advanced +user, allowing her to customize the output of the converter as needed, +a novice user will likely not see the forest for the trees. + +[para] + +To help these latter users an adjunct package is provided, containing +a canned configuration which will generate immediately useful full +parsers. It is + +[list_begin definitions] +[def [package pt::cparam::configuration::critcl]] + +Generated parsers are embedded into a [package Critcl]-based framework. + +[list_end] diff --git a/tcllib/modules/pt/include/export/config/to_json.inc b/tcllib/modules/pt/include/export/config/to_json.inc new file mode 100644 index 0000000..dce6a17 --- /dev/null +++ b/tcllib/modules/pt/include/export/config/to_json.inc @@ -0,0 +1,8 @@ + +[section "[vset TPREFIX]Options"] + +The converter to the JSON grammar exchange format recognizes the +following configuration variables and changes its behaviour as they +specify. + +[include ../../format/options_json.inc] diff --git a/tcllib/modules/pt/include/export/config/to_param.inc b/tcllib/modules/pt/include/export/config/to_param.inc new file mode 100644 index 0000000..091bed2 --- /dev/null +++ b/tcllib/modules/pt/include/export/config/to_param.inc @@ -0,0 +1,51 @@ + +[section "[vset TPREFIX]Options"] + +The converter to PARAM markup recognizes the following configuration +variables and changes its behaviour as they specify. + +[list_begin options] + +[opt_def -template string] + +The value of this configuration variable is a string into which to put +the generated text and the other configuration settings. The various +locations for user-data are expected to be specified with the +placeholders listed below. The default value is "[const @code@]". + +[list_begin definitions] + +[def [const @user@]] +To be replaced with the value of the configuration variable [option -user]. + +[def [const @format@]] +To be replaced with the the constant [const PARAM]. + +[def [const @file@]] +To be replaced with the value of the configuration variable [option -file]. + +[def [const @name@]] +To be replaced with the value of the configuration variable [option -name]. + +[def [const @code@]] +To be replaced with the generated text. + +[list_end] + +[opt_def -name string] + +The value of this configuration variable is the name of the grammar +for which the conversion is run. The default value is [const a_pe_grammar]. + +[opt_def -user string] + +The value of this configuration variable is the name of the user for +which the conversion is run. The default value is [const unknown]. + +[opt_def -file string] + +The value of this configuration variable is the name of the file or +other entity from which the grammar came, for which the conversion is +run. The default value is [const unknown]. + +[list_end] diff --git a/tcllib/modules/pt/include/export/config/to_peg.inc b/tcllib/modules/pt/include/export/config/to_peg.inc new file mode 100644 index 0000000..d99609a --- /dev/null +++ b/tcllib/modules/pt/include/export/config/to_peg.inc @@ -0,0 +1,7 @@ + +[section "[vset TPREFIX]Options"] + +The converter to the PEG language recognizes the following options and +changes its behaviour as they specify. + +[include ../../format/options_peg.inc] diff --git a/tcllib/modules/pt/include/export/config/to_tclparam.inc b/tcllib/modules/pt/include/export/config/to_tclparam.inc new file mode 100644 index 0000000..b09c5b2 --- /dev/null +++ b/tcllib/modules/pt/include/export/config/to_tclparam.inc @@ -0,0 +1,156 @@ + +[section Options] + +The converter to Tcl/PARAM markup recognizes the following +configuration variables and changes its behaviour as they specify. + +[list_begin options] + +[opt_def -template string] + +The value of this configuration variable is a string into which to put +the generated text and the other configuration settings. The various +locations for user-data are expected to be specified with the +placeholders listed below. The default value is "[const @code@]". + +[list_begin definitions] + +[def [const @user@]] +To be replaced with the value of the configuration variable [option -user]. + +[def [const @format@]] +To be replaced with the the constant [const Tcl/PARAM]. + +[def [const @file@]] +To be replaced with the value of the configuration variable [option -file]. + +[def [const @name@]] +To be replaced with the value of the configuration variable [option -name]. + +[def [const @code@]] +To be replaced with the generated Tcl code. + +[list_end] + +The following configuration variables are special, in that they will +occur within the generated code, and are replaced there as well. + +[list_begin definitions] + +[def [const @runtime@]] +To be replaced with the value of the configuration variable [option runtime-command]. + +[def [const @self@]] +To be replaced with the value of the configuration variable [option self-command]. + +[def [const @def@]] +To be replaced with the value of the configuration variable [option proc-command]. + +[def [const @ns@]] +To be replaced with the value of the configuration variable [option namespace]. + +[def [const @main@]] +To be replaced with the value of the configuration variable [option main]. + +[def [const @prelude@]] +To be replaced with the value of the configuration variable [option prelude]. + +[list_end] + +[opt_def -name string] + +The value of this configuration variable is the name of the grammar +for which the conversion is run. The default value is [const a_pe_grammar]. + +[opt_def -user string] + +The value of this configuration variable is the name of the user for +which the conversion is run. The default value is [const unknown]. + +[opt_def -file string] + +The value of this configuration variable is the name of the file or +other entity from which the grammar came, for which the conversion is +run. The default value is [const unknown]. + + +[opt_def -runtime-command string] + +A Tcl string representing the Tcl command or reference to it used to +call PARAM instruction from parser procedures, per the chosen +framework (template). + +The default value is the empty string. + + +[opt_def -self-command string] + +A Tcl string representing the Tcl command or reference to it used to +call the parser procedures (methods ...) from another parser +procedure, per the chosen framework (template). + +The default value is the empty string. + + +[opt_def -proc-command string] + +The name of the Tcl command used to define procedures (methods ...), +per the chosen framework (template). +The default value is [const proc]. + + +[opt_def -namespace string] + +The name of the namespace the parser procedures (methods, ...) shall +reside in, including the trailing '::' needed to separate it from the +actual procedure name. + +The default value is [const ::]. + + +[opt_def -main string] + +The name of the main procedure (method, ...) to be called by the +chosen framework (template) to start parsing input. + +The default value is [const __main]. + + +[opt_def -prelude string] + +A snippet of code to be insert at the head of each generated parsing +command. + +The default value is the empty string. + + +[opt_def -indent integer] + +The number of characters to indent each line of the generated code by. + +The default value is [const 0]. + +[list_end] + +While the high parameterizability of this converter, as shown by the +multitude of options it supports, is an advantage to the advanced +user, allowing her to customize the output of the converter as needed, +a novice user will likely not see the forest for the trees. + +[para] + +To help these latter users two adjunct packages are provided, each +containing a canned configuration which will generate immediately +useful full parsers. These are + +[list_begin definitions] +[def [package pt::tclparam::configuration::snit]] + +Generated parsers are classes based on the [package snit] package, +i.e. snit::type's. + +[def [package pt::tclparam::configuration::tcloo]] + +Generated parsers are classes based on the [package OO] package. + +[list_end] |