You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2013/09/24 15:58:02 UTC

[Bug 52111] Parsing of formula with reference intersection

https://issues.apache.org/bugzilla/show_bug.cgi?id=52111

--- Comment #1 from Matt Hillsdon <mt...@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.

Queries:

(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