[threeten-dev] Review for parsing 2 to 4 years #218

Roger Riggs Roger.Riggs at Oracle.com
Sun Apr 28 19:09:09 PDT 2013


Hi,

The remaining problem is that the pattern "MMdd" or the equivalent
builder appends of "Value(2), Value(2)", is not recognized as using
adjacent parsing.  When set to lenient the NumberPP parse of "MM"
gobbles up all the input leaving nothing for 'dd'.
(This is a new issue since NumberPP in lenient mode is no longer limited 
to maxWidth).

If the field is marked as withfixedWidth (subsequentWidth == -1) the 
field is no longer lenient.

The problem that remains is that a field identified by the builder 
(minWidth == maxWidth)
as fixed width may not actually be fixed width at the time the PP is 
invoked.

I am inclined to think that adjacent value mode must always be engaged,
even for fixed fields.  The first fixed field must be informed that it 
is followed by
fixed fields.

Roger



On 4/26/2013 4:00 PM, Stephen Colebourne wrote:
>
> On 26 Apr 2013 20:32, "roger riggs" <roger.riggs at oracle.com 
> <mailto:roger.riggs at oracle.com>> wrote:
> > Start with a hard one.  "yyMMdd" in the case where 
> ReducedValue/NumberPP is set to lenient.
> >
> > "76321" could be parsed as (76, 3, 21) or (76, 32, 1)
>
> Should be 7, 63, 21
>
> > "765432" could be parsed several ways.  (76, 5, 432) (76, 54, 32), etc.
>
> 76 54 32
>
> The first is variable and the others fixed. Thus lenient could only 
> impact the first if others are fixed width.
> Stephen
>
> > The subsequentWidth mechanism only works for fixed fields
> > following a variable width field.  If the parsing is set to lenient
> > then what was a fixed field is now variable but the static mechanism
> > for lookahead can't anticipate that.
> >
> > The current mechanism works fine as long as fixed width fields
> > have the same width whether lenient or strict.  I think it is 
> unnecessary
> > and too big a change to modify NumberPP to extend lenient parsing to
> > fixed width fields.
> >
> > Roger
> >
> >
> >
> >
> > On 4/26/2013 2:13 PM, Stephen Colebourne wrote:
> >>
> >> On 26 April 2013 16:14, roger riggs <roger.riggs at oracle.com 
> <mailto:roger.riggs at oracle.com>> wrote:
> >>>
> >>> Suggestions?
> >>
> >> I think we should start with a set of test cases we agree on. Then
> >> whatever code needs to be changed will have to be changed. It sounds
> >> like the adjacent value parsing mechanism will need some tweaking.
> >>
> >> Stephen
> >
> >
>




More information about the threeten-dev mailing list