When parsing 2-argument formula _xll.HEAT($B3,$C3), FormulaParser creates an org.apache.poi.ss.formula.ptg.FuncVarPtg [#external# nArgs=3] token with _numberOfArgs = 3 and 3 children, the first of which contains the function name (a org.apache.poi.ss.formula.ptg.NameXPxg [sheet=null ! name=_xll.HEAT] token). _xll.HEAT is an Excel add-in function, but he same applies to UDF functions, eg for formula myUDF(23, F4). Is this intentional? The parse tree structure does not seem correct, because it is inconsistent with the case of build-in Excel functions, whose arguments in the parse tree only include actual arguments and not the function name.
Yes, external functions include the function name as the first token. This is correct. Adding are essentially a collection of UDFs. I believe this is how functions in the AnalysisToolPak are parsed into tokens.