Fix parser invalid index error that occurred when a field name was the same as an Excel function name. EPPlus treated the field name as a 'Function' even if the name was not followed by a left paranthesis to enclose the function arguments following the 'Function' name. We now treat the field name as a 'Name' rather than as a 'Function' when no left parathensis follows the field name. This is true even if the field name is the same as an Excel function name.
diff --git a/EPPlus/FormulaParsing/LexicalAnalysis/SourceCodeTokenizer.cs b/EPPlus/FormulaParsing/LexicalAnalysis/SourceCodeTokenizer.cs index a0d5d47..f397e84 100644 --- a/EPPlus/FormulaParsing/LexicalAnalysis/SourceCodeTokenizer.cs +++ b/EPPlus/FormulaParsing/LexicalAnalysis/SourceCodeTokenizer.cs
@@ -199,7 +199,7 @@ for (int i = 0; i < context.Result.Count; i++) { var token=context.Result[i]; - if (token.TokenType == TokenType.Unrecognized) + if (token.TokenType == TokenType.Unrecognized || token.TokenType == TokenType.Function) { if (i < context.Result.Count - 1) {