This section is used to list various settable options used by the off-line finite state machine generator. When generating the source code for the off-line state machine, these options are used to configure parts of the output source code.
The list of options contained between the opening and closing curly braces of
the options
section can be in one of two formats. Either each
option is just a keyword setting a flag to true, or a keyword followed by an
identifier string. Options are separated from each other by commas, meaning that
no comma is required after the last option in the list. At present, the
following table lists all the options that have been implemented
At present there are four possible options that can be set in the options section:
OPTION | DEFAULT | DESCRIPTION |
assemblyref dllName |
(No default) | This option is equivalent to adding a reference to an external assembly
if the types in that assembly are needed by the inline source code
in the grammar file. This option is only permitted in grammars that
are being parsed for use in an inline state machine. If this option appears
in a grammar that is compiled with ParseLR.exe, it will cause an
error message to be displayed, and no output source code will
be generated. The alternative option reference is an alias
for assemblyref . |
using nameSpaceName |
(No default) | This option adds a using statement to the top of the generated
source file when creating the source code for an off-line FSM. Its
purpose is to allow the action or guard function code embedded in the off-line version of
the grammar rules to gain access to .NET libraries or project DLLs
without having to spell out full namespaces on library members. This
option can appear multiple times, thereby permitting multiple
using statements to be added to the source code. Note that there
is a default list of namespaces for which using statements
are added to the source code anyway. The list includes: System ,
System.Linq , System.Text , System.IO ,
and System.Collections.Generic . If you provide no
using statements in the options section, these are
automatically added. If you provide any using statements,
this automatic addition is disabled and you will have to provide
using statements for each library namespace your FSM code will
need. |
namespace nameSpaceName |
StateMachine | This sets the namespace for the output source code when creating an off-line parser. The value should match the namespace within which the FSM class will be compiled along with its other application-specific classes. |
fsmclass className |
MyFSM |
This sets the name of the FSM class in the source code. It should obviously match the FSM class name you have chosen in your non-auto-generated part of the parser class. |
options
{
assemblyref MyLib.dll, // Example of an external assembly reference
using System.Reflection, // Clearly our application uses the reflection APIs
using System.Xml, // An example of a second using statement
namespace LightController, // Set the enclosing namespace for the FSM code
fsmclass LightFSM // Note the absence of a trailing comma
}