You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Richard Liang <ri...@gmail.com> on 2006/06/28 13:29:15 UTC

[classlib] Requirement: Regex support for \p{javaDigit}

Hello All,

I'm trying to implement java.util.Scanner.nextInt, which requires a 
regular expression pattern to represent  "Integer". I find it's hard to 
express /NonASCIIDigit /because now Harmony regex does not support 
/NonASCIIDigit/.

As our regex has supported "\p{javaLowerCase}     Equivalent to 
java.lang.Character.isLowerCase()", to facilitate the development of 
j.u.Scanner, shall we provide support for "\p{javaDigit}", which is 
equivalent to java.lang.Character.isDigit()? I could provide patch for 
this feature if there is no objection. Thanks lot.
*
*You may want to refer to the number syntax in java.util.Scanner Spec:*
*/<QUOTE>
NonASCIIDigit  :: = A non-ASCII character c for which 
Character.isDigit(c) returns true

Non0Digit  ::= [1-Rmax] | NonASCIIDigit

Digit  ::= [0-Rmax] | NonASCIIDigit

GroupedNumeral  ::  = ( Non0Digit Digit? Digit? ( LocalGroupSeparator 
Digit Digit Digit )+ )

Numeral  ::= ( ( Digit+ )  |  GroupedNumeral )

Integer  ::= ( [-+]? ( Numeral ) )  |  LocalPositivePrefix Numeral 
LocalPositiveSuffix  |  LocalNegativePrefix Numeral LocalNegativeSuffix/
/</QUOTE>/


-- 
Richard Liang
China Software Development Lab, IBM 


Re: [classlib] Requirement: Regex support for \p{javaDigit}

Posted by Richard Liang <ri...@gmail.com>.
That's great! Nik. You're so helpful. Thanks a lot.  ;-)

Nikolay Kuznetsov wrote:
> Hello Richard,
> Thanks for pointing this out. While implementing java character
> classes I missed the fact that _all_ Character.isXXX methods except
> deprecated should have corresponding \\p{javaXXX} character class
> analogues. So the the answer to your question whether we should
> implement javaDigit char class is YES.
>
> I've opened an issue to support the rest of character classes:
> http://issues.apache.org/jira/browse/HARMONY-696
>
> Also, thanks a lot for your willing to add javaDigit class, but if you
> don't mind I would implement full range of {javaXXX} classes by myself
> just because it would be easier for me, as for an author :-).
> Hopefully, I'll be ready with this tomorrow.
>
> On 6/28/06, Richard Liang <ri...@gmail.com> wrote:
>> Hello All,
>>
>> I'm trying to implement java.util.Scanner.nextInt, which requires a
>> regular expression pattern to represent  "Integer". I find it's hard to
>> express /NonASCIIDigit /because now Harmony regex does not support
>> /NonASCIIDigit/.
>>
>> As our regex has supported "\p{javaLowerCase}     Equivalent to
>> java.lang.Character.isLowerCase()", to facilitate the development of
>> j.u.Scanner, shall we provide support for "\p{javaDigit}", which is
>> equivalent to java.lang.Character.isDigit()? I could provide patch for
>> this feature if there is no objection. Thanks lot.
>> *
>> *You may want to refer to the number syntax in java.util.Scanner Spec:*
>> */<QUOTE>
>> NonASCIIDigit  :: = A non-ASCII character c for which
>> Character.isDigit(c) returns true
>>
>> Non0Digit  ::= [1-Rmax] | NonASCIIDigit
>>
>> Digit  ::= [0-Rmax] | NonASCIIDigit
>>
>> GroupedNumeral  ::  = ( Non0Digit Digit? Digit? ( LocalGroupSeparator
>> Digit Digit Digit )+ )
>>
>> Numeral  ::= ( ( Digit+ )  |  GroupedNumeral )
>>
>> Integer  ::= ( [-+]? ( Numeral ) )  |  LocalPositivePrefix Numeral
>> LocalPositiveSuffix  |  LocalNegativePrefix Numeral LocalNegativeSuffix/
>> /</QUOTE>/
>>
>>
>> -- 
>> Richard Liang
>> China Software Development Lab, IBM
>>
>>
>>
>
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>
>

-- 
Richard Liang
China Software Development Lab, IBM 



---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Re: [classlib] Requirement: Regex support for \p{javaDigit}

Posted by Nikolay Kuznetsov <ni...@gmail.com>.
Hello Richard,
Thanks for pointing this out. While implementing java character
classes I missed the fact that _all_ Character.isXXX methods except
deprecated should have corresponding \\p{javaXXX} character class
analogues. So the the answer to your question whether we should
implement javaDigit char class is YES.

I've opened an issue to support the rest of character classes:
http://issues.apache.org/jira/browse/HARMONY-696

Also, thanks a lot for your willing to add javaDigit class, but if you
don't mind I would implement full range of {javaXXX} classes by myself
just because it would be easier for me, as for an author :-).
Hopefully, I'll be ready with this tomorrow.

On 6/28/06, Richard Liang <ri...@gmail.com> wrote:
> Hello All,
>
> I'm trying to implement java.util.Scanner.nextInt, which requires a
> regular expression pattern to represent  "Integer". I find it's hard to
> express /NonASCIIDigit /because now Harmony regex does not support
> /NonASCIIDigit/.
>
> As our regex has supported "\p{javaLowerCase}     Equivalent to
> java.lang.Character.isLowerCase()", to facilitate the development of
> j.u.Scanner, shall we provide support for "\p{javaDigit}", which is
> equivalent to java.lang.Character.isDigit()? I could provide patch for
> this feature if there is no objection. Thanks lot.
> *
> *You may want to refer to the number syntax in java.util.Scanner Spec:*
> */<QUOTE>
> NonASCIIDigit  :: = A non-ASCII character c for which
> Character.isDigit(c) returns true
>
> Non0Digit  ::= [1-Rmax] | NonASCIIDigit
>
> Digit  ::= [0-Rmax] | NonASCIIDigit
>
> GroupedNumeral  ::  = ( Non0Digit Digit? Digit? ( LocalGroupSeparator
> Digit Digit Digit )+ )
>
> Numeral  ::= ( ( Digit+ )  |  GroupedNumeral )
>
> Integer  ::= ( [-+]? ( Numeral ) )  |  LocalPositivePrefix Numeral
> LocalPositiveSuffix  |  LocalNegativePrefix Numeral LocalNegativeSuffix/
> /</QUOTE>/
>
>
> --
> Richard Liang
> China Software Development Lab, IBM
>
>
>

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org