Class SourceCodeTokenizer
Source code tokenizer
Inheritance
System.Object
SourceCodeTokenizer
Implements
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: OfficeOpenXml.FormulaParsing.LexicalAnalysis
Assembly: EPPlus.dll
Syntax
public class SourceCodeTokenizer : ISourceCodeTokenizer
Constructors
SourceCodeTokenizer(IFunctionNameProvider, INameValueProvider, Boolean, Boolean, Boolean)
Declaration
public SourceCodeTokenizer(IFunctionNameProvider functionRepository, INameValueProvider nameValueProvider, bool r1c1 = false, bool keepWhitespace = false, bool pivotFormula = false)
Parameters
Type | Name | Description |
---|---|---|
IFunction |
functionRepository | A function name provider |
IName |
nameValueProvider | A name value provider |
System. |
r1c1 | If true the tokenizer will use the R1C1 format |
System. |
keepWhitespace | If true whitspaces in formulas will be preserved |
System. |
pivotFormula | If the formula is from a calculated column in a pivot table. |
Properties
Default
The default tokenizer. This tokenizer will remove and ignore whitespaces.
Declaration
public static ISourceCodeTokenizer Default { get; }
Property Value
Type | Description |
---|---|
ISource |
Default_KeepWhiteSpaces
The default tokenizer. This tokenizer will remove and ignore whitespaces.
Declaration
public static ISourceCodeTokenizer Default_KeepWhiteSpaces { get; }
Property Value
Type | Description |
---|---|
ISource |
PivotFormula
Declaration
public static ISourceCodeTokenizer PivotFormula { get; }
Property Value
Type | Description |
---|---|
ISource |
R1C1
The tokenizer used for r1c1 format. This tokenizer will keep whitespaces and add them as tokens.
Declaration
public static ISourceCodeTokenizer R1C1 { get; }
Property Value
Type | Description |
---|---|
ISource |
Methods
Tokenize(String)
Split the input string into tokens used by the formula parser
Declaration
public IList<Token> Tokenize(string input)
Parameters
Type | Name | Description |
---|---|---|
System. |
input |
Returns
Type | Description |
---|---|
System. |
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.
Declaration
public IList<Token> Tokenize(string input, string worksheet)
Parameters
Type | Name | Description |
---|---|---|
System. |
input | The formula to tokenize |
System. |
worksheet | The worksheet name. |
Returns
Type | Description |
---|---|
System. |
Exceptions
Type | Condition |
---|---|
Invalid |
Thrown if the formula is not valid. |