poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 52111] Parsing of formula with reference intersection
Date Tue, 24 Sep 2013 13:58:02 GMT

--- Comment #1 from Matt Hillsdon <mth-asf@corefiling.co.uk> ---
Created attachment 30878
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=30878&action=edit
Proposed fix for intersections

I've been looking into intersection parsing and have attached a patch against
trunk r1525871 which I believe fixes this.  I would appreciate review from
someone familiar with the formula parsing code.

There are two issues parsing "(C2:D3 D3:E4)":

(1) Intersection parsing is unsupported.  It requires changing the lexing in
GetChar to track whitespace state because although we generally skip whitespace
the intersection operator is a space.  This approach seems the least invasive
as it allows the rest of the parse to continue skipping whitespace.

(2) Having fixed that, brackets are not supported around expressions with lower
precedence than comparison operations (previously just union; now union and
intersection).  This seems to be a matter of changing parseSimpleFactor to call
unionExpression (the root of the parse) inside the matches for parentheses.

Existing tests pass and I've added some covering the intersection and
parenthesis behaviour in TestFormulaParser.


(a) The formula "1 2" was a tested parser fail case.  It now parses as a
intersection.  "1,2" already parsed as a union.  Neither make sense and Excel
understandably complains.  Does/should the POI FormulaParser attempt to cope
with this type of error?  In a more elaborate compiler this might be a type
analysis error rather than something caught by the parse.  Is there any POI
code that attempts this kind of thing?

(b) The documentation pulled in via the svn:external to
src/documentation/content/xdocs/spreadsheet/formula.xml claims intersections
and unions are not yet supported.  Is the union documentation just out of date,
or is there some other sense in which it isn't supported?  If it's just out of
date then I guess "Region operators: union, intersection" just wants to move
from the unsupported to the supported section.  I can supply a separate patch
if required.

You are receiving this mail because:
You are the assignee for the bug.

To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org

View raw message