/** * Parse a formula into a array of tokens * * @param formula the formula to parse * @param workbook the parent workbook * @param formulaType the type of the formula, see {@link FormulaType} * @param sheetIndex the 0-based index of the sheet this formula belongs to. The sheet index is * required to resolve sheet-level names. <code>-1</code> means that the scope of the name * will be ignored and the parser will match names only by name * @return array of parsed tokens * @throws FormulaParseException if the formula has incorrect syntax or is otherwise invalid */ public static Ptg[] parse( String formula, FormulaParsingWorkbook workbook, int formulaType, int sheetIndex) { FormulaParser fp = new FormulaParser(formula, workbook, sheetIndex); fp.parse(); return fp.getRPNPtg(formulaType); }