Show / Hide Table of Contents

Class SourceCodeTokenizer

Source code tokenizer

Inheritance
System.Object
SourceCodeTokenizer
Implements
ISourceCodeTokenizer
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
IFunctionNameProvider functionRepository

A function name provider

INameValueProvider nameValueProvider

A name value provider

System.Boolean r1c1

If true the tokenizer will use the R1C1 format

System.Boolean keepWhitespace

If true whitspaces in formulas will be preserved

System.Boolean 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
ISourceCodeTokenizer

Default_KeepWhiteSpaces

The default tokenizer. This tokenizer will remove and ignore whitespaces.

Declaration
public static ISourceCodeTokenizer Default_KeepWhiteSpaces { get; }
Property Value
Type Description
ISourceCodeTokenizer

PivotFormula

Declaration
public static ISourceCodeTokenizer PivotFormula { get; }
Property Value
Type Description
ISourceCodeTokenizer

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
ISourceCodeTokenizer

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.String input
Returns
Type Description
System.Collections.Generic.IList<Token>

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.String input

The formula to tokenize

System.String worksheet

The worksheet name.

Returns
Type Description
System.Collections.Generic.IList<Token>
Exceptions
Type Condition
InvalidFormulaException

Thrown if the formula is not valid.

Implements

ISourceCodeTokenizer
In This Article
  • Constructors
    • SourceCodeTokenizer(IFunctionNameProvider, INameValueProvider, Boolean, Boolean, Boolean)
  • Properties
    • Default
    • Default_KeepWhiteSpaces
    • PivotFormula
    • R1C1
  • Methods
    • Tokenize(String)
    • Tokenize(String, String)
  • Implements
Back to top Generated by DocFX