Version

Insert(Int32,String,String,TerminalSymbolComparison,Boolean) Method

Inserts a new TerminalSymbol into the collection with the specified name.
Syntax
'Declaration
 
Public Overloads Function Insert( _
   ByVal index As Integer, _
   ByVal name As String, _
   Optional ByVal value As String, _
   Optional ByVal comparison As TerminalSymbolComparison, _
   Optional ByVal isExitSymbol As Boolean _
) As TerminalSymbol
public TerminalSymbol Insert( 
   int index,
   string name,
   string value,
   TerminalSymbolComparison comparison,
   bool isExitSymbol
)

Parameters

index
The zero-based index at which to insert the symbol.
name
The Symbol.Name of the new symbol.
value
The value indicating the text which must be matched for the terminal symbol to be recognized within the text. If null, the name will be used as the value.
comparison
Indicates how the text should be interpreted: as a case-sensitive literal string, a case-insensitive literal string, or a regular expression.
isExitSymbol
Indicates whether the symbol should be an exit symbol for the lexer state.

Return Value

The TerminalSymbol instance which was inserted into the collection.
Exceptions
ExceptionDescription
System.InvalidOperationExceptionOccurs when the owning LexerState does not belong to a Grammar.
System.InvalidOperationExceptionOccurs when the IsMutable value of the owning Grammar is False.
System.ArgumentNullExceptionOccurs when name is null or empty.
System.ArgumentOutOfRangeExceptionOccurs when index is less than 0 or greater than the Count.
System.ArgumentException Occurs when a symbol of the owning Grammar already exists with the specified name.
System.ArgumentExceptionOccurs when comparison is not defined in the TerminalSymbolComparison enumeration.
System.ArgumentExceptionOccurs when isExitSymbol is True and the owning LexerState is the default lexer state.
Remarks

If the LexerState owning the collection is not the default lexer state, the symbol can optionally be added as an exit symbol. If it is an exit symbol, the lexer state will be exited when tokens associated with the symbol are created by the lexer. When a lexer state is exited, the lexer will go back to the state it was in before the state was entered. A LexerState will be entered when a token is created which is associated with a TerminalSymbol that has a TerminalSymbol.LexerStateToEnter set. If a TerminalSymbol is both an exit symbol and it has a LexerStateToEnter set, the LexerStateToEnter will be ignored. The lexer cannot enter and exit a state at the same time and exiting a lexer state takes precedence.

Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also