org.apache.poi.ss.formula
Class FormulaParser
java.lang.Object
org.apache.poi.ss.formula.FormulaParser
public final class FormulaParser
- extends java.lang.Object
This class parses a formula string into a List of tokens in RPN order.
Inspired by
Lets Build a Compiler, by Jack Crenshaw
BNF for the formula expression is :
::= [ ]*
::= [ ]*
::= | () | |
::= ([expression [, expression]*])
For POI internal use only
- Author:
- Avik Sengupta , Andrew C. oliver (acoliver at apache dot org), Eric Ladner (eladner at goldinc dot com), Cameron Riley (criley at ekmail.com), Peter M. Murray (pete at quantrix dot com), Pavel Krupets (pkrupets at palmtreebusiness dot com), Josh Micich, David Lewis (DLewis400 at gmail dot com)
Method Summary |
static Ptg[] |
parse(java.lang.String formula,
FormulaParsingWorkbook workbook,
int formulaType,
int sheetIndex)
Parse a formula into a array of tokens |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
parse
public static Ptg[] parse(java.lang.String formula,
FormulaParsingWorkbook workbook,
int formulaType,
int sheetIndex)
- Parse a formula into a array of tokens
- Parameters:
formula
- the formula to parseworkbook
- the parent workbookformulaType
- the type of the formula, see FormulaType
sheetIndex
- the 0-based index of the sheet this formula belongs to.
The sheet index is required to resolve sheet-level names. -1
means that
the scope of the name will be ignored and the parser will match names only by name
- Returns:
- array of parsed tokens
- Throws:
FormulaParseException
- if the formula has incorrect syntax or is otherwise invalid
Copyright 2012 The Apache Software Foundation or
its licensors, as applicable.