[ragel-users] How to convert [#x2070-#x218F] to Ragel grammar?

Adrian Thurston adrian.thurston at esentire.com
Fri Nov 20 19:22:33 UTC 2009


If you wish to process a a byte at a time, this is what I would suggest.

You may also want to do a first pass to convert to some multibyte 
encoding and then process that. In that case you set alphtype to 
something bigger than char.

-Adrian

Григорий Фучеджи wrote:
> I think this would work
> (0x20 0x70..0xFF) | (0x21 0x00..0x8F)
> But I think there should be better solution
> __
> Grygoriy Fuchedzhy
> 
> On Fri, Nov 20, 2009 at 8:39 PM, Iñaki Baz Castillo <ibc at aliax.net 
> <mailto:ibc at aliax.net>> wrote:
> 
>     Hi, I'm creating a parsing for XML Xpath but in the grammar specs I
>     find:
> 
> 
>     http://www.w3.org/TR/REC-xml/#NT-NameStartChar
> 
>     NameStartChar  ::=  ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] |
>     [#xD8-#xF6] |
>                        [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] |
>                        [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] |
>                        [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] |
>                        [#x10000-#xEFFFF]
> 
> 
>     http://www.w3.org/TR/REC-xml/#NT-NameChar
> 
>     NameChar       ::=  NameStartChar | "-" | "." | [0-9] | #xB7 |
>                        [#x0300-#x036F] | [#x203F-#x2040]
> 
> 
> 
>     I've no idea of how to convert them to Ragel grammar. Of course the
>     following
>     conversion is wrong:
> 
>      [#x2070-#x218F]  =>  0x2070..0x218F
> 
>     as Ragel complains "literal 0x2C00 overflows the alphabet type".
> 
> 
>     Any help please? Thanks a lot.
> 
>     --
>     Iñaki Baz Castillo <ibc at aliax.net <mailto:ibc at aliax.net>>
> 
>     _______________________________________________
>     ragel-users mailing list
>     ragel-users at complang.org <mailto:ragel-users at complang.org>
>     http://www.complang.org/mailman/listinfo/ragel-users
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> ragel-users mailing list
> ragel-users at complang.org
> http://www.complang.org/mailman/listinfo/ragel-users




More information about the ragel-users mailing list