Bug 44504

Summary: [patch] Improvements to FormulaParser - operators, precedence, error literals, etc
Product: POI Reporter: Josh Micich <josh>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: enhancement    
Priority: P2    
Version: 3.0-dev   
Target Milestone: ---   
Hardware: Other   
OS: All   
Attachments: svn diff of 10 changed files
tar bzip of 3 added files

Description Josh Micich 2008-02-28 02:50:02 UTC
There's some big changes here.  It's best to first look at all of the added test cases in TestFormulaParser to get an overview of the work.  (The new tests can be merged in first, to observe POI's current behaviour with

Added support for parsing of '%' in formulas.
Fixed operator precedence (and confirmed associativity):
	(), %, ^, * /, + -, &, = <> > >= < <= 
Simplified missing arg parse logic and confirmed with test
Added support for error literals (like #REF!) in formulas.
Fixed parsing of string literals
Simplified logic of rendering IF() and external functions

Started support for evaluation of external functions.

Made FormulaParser detect when the input string has not been consumed.  Removed all occurrences appending a semicolon to the formula before parsing (that code made no difference before).

Performed major refactorings inside FormulaParser to fix all of this.
Added class FormulaParser.FormulaParseException to help distinguish specific parsing errors from internal POI errors.
Comment 1 Josh Micich 2008-02-28 02:51:41 UTC
Created attachment 21598 [details]
svn diff of 10 changed files
Comment 2 Josh Micich 2008-02-28 02:52:31 UTC
Created attachment 21599 [details]
tar bzip of 3 added files
Comment 3 Nick Burch 2008-03-04 08:49:07 UTC
Applied to svn trunk, thanks