Class TokenizerContext
Responsible for handling tokens during the tokenizing process.
Inheritance
Inherited Members
Namespace: OfficeOpenXml.FormulaParsing.LexicalAnalysis
Assembly: EPPlus.dll
Syntax
public class TokenizerContextConstructors
TokenizerContext(String, String, ITokenFactory)
Constructor
Declaration
public TokenizerContext(string formula, string worksheet, ITokenFactory tokenFactory)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | formula | The formula to tokenize | 
| System.String | worksheet | Worksheet name, if applicable | 
| ITokenFactory | tokenFactory | A ITokenFactory instance | 
Properties
CurrentToken
Returns the current
Declaration
public string CurrentToken { get; }Property Value
| Type | Description | 
|---|---|
| System.String | 
CurrentTokenHasValue
Declaration
public bool CurrentTokenHasValue { get; }Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
FormulaChars
The formula split into a character array
Declaration
public char[] FormulaChars { get; }Property Value
| Type | Description | 
|---|---|
| System.Char[] | 
IsInSheetName
Returns true if the current position is inside a sheetname, otherwise false.
Declaration
public bool IsInSheetName { get; }Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
IsInString
Returns true if the current position is inside a string, otherwise false.
Declaration
public bool IsInString { get; }Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
LastToken
Returns the last token of the result, if empty null/default(Token?) will be returned.
Declaration
public Token? LastToken { get; }Property Value
| Type | Description | 
|---|---|
| System.Nullable<Token> | 
Result
The tokens created
Declaration
public IList<Token> Result { get; }Property Value
| Type | Description | 
|---|---|
| System.Collections.Generic.IList<Token> | 
Methods
AddToken(Token)
Declaration
public void AddToken(Token token)Parameters
| Type | Name | Description | 
|---|---|---|
| Token | token | 
AppendToCurrentToken(Char)
Declaration
public void AppendToCurrentToken(char c)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Char | c | 
AppendToLastToken(String)
Declaration
public void AppendToLastToken(string stringToAppend)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | stringToAppend | 
ChangeTokenType(TokenType, Int32)
Changes TokenType of the current token.
Declaration
public void ChangeTokenType(TokenType tokenType, int index)Parameters
| Type | Name | Description | 
|---|---|---|
| TokenType | tokenType | The new TokenType | 
| System.Int32 | index | Index of the token to change | 
ChangeValue(String, Int32)
Changes the value of the current token
Declaration
public void ChangeValue(string val, int index)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | val | |
| System.Int32 | index | Index of the token to change | 
CreateHandler()
Declaration
public TokenHandler CreateHandler()Returns
| Type | Description | 
|---|---|
| TokenHandler | 
GetNextTokenAfterIndex(Int32)
Returns the token after the requested index
Declaration
public Token GetNextTokenAfterIndex(int index)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | index | The requested index | 
Returns
| Type | Description | 
|---|---|
| Token | The Token at the requested position | 
GetTokenBeforeIndex(Int32)
Returns the token before the requested index
Declaration
public Token GetTokenBeforeIndex(int index)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | index | The requested index | 
Returns
| Type | Description | 
|---|---|
| Token | The Token at the requested position | 
NewToken()
Declaration
public void NewToken()PostProcess()
Declaration
public void PostProcess()RemoveAt(Int32)
Removes the token at the requested Token
Declaration
public void RemoveAt(int index)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | index | 0-based index of the requested position | 
Replace(Int32, Token)
Replaces a token at the requested index
Declaration
public void Replace(int index, Token newValue)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | index | 0-based index of the requested position | 
| Token | newValue | The new Token | 
ReplaceLastToken(Token)
Replaces the last token of the result with the newToken
Declaration
public void ReplaceLastToken(Token newToken)Parameters
| Type | Name | Description | 
|---|---|---|
| Token | newToken | The new token | 
SetLastTokenType(TokenType)
Changes the TokenType of the last token in the result.
Declaration
public void SetLastTokenType(TokenType type)Parameters
| Type | Name | Description | 
|---|---|---|
| TokenType | type | 
ToggleIsInSheetName()
Toggles the IsInSheetName state
Declaration
public void ToggleIsInSheetName()ToggleIsInString()
Toggles the IsInString state.
Declaration
public void ToggleIsInString()