Class SourceCodeTokenizer
- Namespace
- OfficeOpenXml.FormulaParsing.LexicalAnalysis
- Assembly
- EPPlus.dll
Source code tokenizer
public class SourceCodeTokenizer : ISourceCodeTokenizer
- Inheritance
-
SourceCodeTokenizer
- Implements
- Inherited Members
Constructors
SourceCodeTokenizer(IFunctionNameProvider, INameValueProvider, bool, bool, bool)
public SourceCodeTokenizer(IFunctionNameProvider functionRepository, INameValueProvider nameValueProvider, bool r1c1 = false, bool keepWhitespace = false, bool pivotFormula = false)
Parameters
functionRepository
IFunctionNameProviderA function name provider
nameValueProvider
INameValueProviderA name value provider
r1c1
boolIf true the tokenizer will use the R1C1 format
keepWhitespace
boolIf true whitspaces in formulas will be preserved
pivotFormula
boolIf the formula is from a calculated column in a pivot table.
Properties
Default
The default tokenizer. This tokenizer will remove and ignore whitespaces.
public static ISourceCodeTokenizer Default { get; }
Property Value
Default_KeepWhiteSpaces
The default tokenizer. This tokenizer will remove and ignore whitespaces.
public static ISourceCodeTokenizer Default_KeepWhiteSpaces { get; }
Property Value
PivotFormula
public static ISourceCodeTokenizer PivotFormula { get; }
Property Value
R1C1
The tokenizer used for r1c1 format. This tokenizer will keep whitespaces and add them as tokens.
public static ISourceCodeTokenizer R1C1 { get; }
Property Value
Methods
Tokenize(string)
Split the input string into tokens used by the formula parser
public IList<Token> Tokenize(string input)
Parameters
input
string
Returns
Tokenize(string, string)
Splits a formula in tokens used in when calculating for example a worksheet cell, defined name or a pivot table field formula.
public IList<Token> Tokenize(string input, string worksheet)
Parameters
Returns
Exceptions
- InvalidFormulaException
Thrown if the formula is not valid.