Hi all,<div><br></div><div>When i want to use ragel to parser uri abnf from rfc3986, but meet some error.</div><div><br></div><div>First, i get the abnf from that rfc, then convert it to ragel form. As bellow:</div><div>#-----------------------------------------------------------------------------------------------------</div>
<div><div>%%{</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>machine URI;</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>action ActionStartScheme<span class="Apple-tab-span" style="white-space:pre"> </span>{ StartScheme(fpc); }</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>action ActionEndScheme<span class="Apple-tab-span" style="white-space:pre"> </span>{ EndScheme(fpc); }</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>action ActionStartAuthority<span class="Apple-tab-span" style="white-space:pre"> </span>{ StartAuthority(fpc); }</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>action ActionEndAuthority<span class="Apple-tab-span" style="white-space:pre"> </span>{ EndAuthority(fpc); }</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>action ActionStartUser<span class="Apple-tab-span" style="white-space:pre"> </span>{ StartUser(fpc); }</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>action ActionEndUser<span class="Apple-tab-span" style="white-space:pre"> </span>{ EndUser(fpc); }</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>action ActionStartHost<span class="Apple-tab-span" style="white-space:pre"> </span>{ StartHost(fpc); }</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>action ActionEndHost<span class="Apple-tab-span" style="white-space:pre"> </span>{ EndHost(fpc); }</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>action ActionStartPort<span class="Apple-tab-span" style="white-space:pre"> </span>{ StartPort(fpc); }</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>action ActionEndPort<span class="Apple-tab-span" style="white-space:pre"> </span>{ EndPort(fpc); }</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>action ActionStartPath<span class="Apple-tab-span" style="white-space:pre"> </span>{ StartPath(fpc); }</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>action ActionEndPath<span class="Apple-tab-span" style="white-space:pre"> </span>{ EndPath(fpc); }</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>action ActionStartQuery<span class="Apple-tab-span" style="white-space:pre"> </span>{ StartQuery(fpc); }</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>action ActionEndQuery<span class="Apple-tab-span" style="white-space:pre"> </span>{ EndQuery(fpc); }</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>action ActionStartFragment<span class="Apple-tab-span" style="white-space:pre"> </span>{ StartFragment(fpc); }</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>action ActionEndFragment<span class="Apple-tab-span" style="white-space:pre"> </span>{ EndFragment(fpc); }</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>action All<span class="Apple-tab-span" style="white-space:pre"> </span>{ printf("%c", fc); }</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#ALPHA<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>%x41-5A / %x61-7A</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>ALPHA<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>0x41..0x5A | 0x61..0x7A;</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#CR<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>%x0D</div><div>
<span class="Apple-tab-span" style="white-space:pre"> </span>CR<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>0x0D;</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#DIGIT<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>%x30-39</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>DIGIT<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>0x30..0x39;</div><div><br>
</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#DQUOTE<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>%x22</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>DQUOTE<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>0x22;</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#HEXDIG<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>DIGIT / "A" / "B" / "C" / "D" / "E" / "F"</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>HEXDIG<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>DIGIT | "A" | "B" | "C" | "D" | "E" | "F";</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#LF<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>%x0A</div><div>
<span class="Apple-tab-span" style="white-space:pre"> </span>LF<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>0x0A;</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#SP<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>%x20</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>SP<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>0x20;</div><div><br></div><div>
<span class="Apple-tab-span" style="white-space:pre"> </span>#unreserved<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>ALPHA / DIGIT / "-" / "." / "_" / "~"</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>unreserved<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>ALPHA | DIGIT | "-" | "." | "_" | "~";</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#dec-octet<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>( DIGIT ) / ( %x31-39 DIGIT ) / ( "1" 2DIGIT ) / ( "2" %x30-34 DIGIT ) / ( "25" %x30-35 )</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>dec_octet<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>( DIGIT ) | ( 0x31..0x39 DIGIT ) | ( "1" DIGIT{2} ) | ( "2" 0x30..0x34 DIGIT ) | ( "25" 0x30..0x35 );</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#pct-encoded<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>"%" HEXDIG HEXDIG</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>pct_encoded<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>"%" HEXDIG HEXDIG;</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#gen-delims<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>":" / "/" / "?" / "#" / "[" / "]" / "@"</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>gen_delims<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>":" | "/" | "?" | "#" | "[" | "]" | "@";</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#sub-delims<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>"!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>sub_delims<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>"!" | "$" | "&" | "'" | "(" | ")" | "*" | "+" | "," | ";" | "=";</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#reserved<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>gen-delims / sub-delims</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>reserved<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>gen_delims | sub_delims;</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#pchar<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>unreserved / pct-encoded / sub-delims / ":" / "@"</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>pchar<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>unreserved | pct_encoded | sub_delims | ":" | "@";</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#query<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>*( pchar / "/" / "?" )</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>query<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>( ( pchar | "/" | "?" )* );</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#fragment<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>*( pchar / "/" / "?" )</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>fragment<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>( pchar | "/" | "?" )*;</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#segment<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>*pchar</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>segment<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>pchar*;</div><div><br></div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>#segment-nz<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>1*pchar</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>segment_nz<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>pchar+;</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#segment-nz-nc<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>1*( unreserved / pct-encoded / sub-delims / "@" )</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>segment_nz_nc<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>( unreserved | pct_encoded | sub_delims | "@" )+;</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#path-empty<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>0<pchar></div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>path_empty<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>"";</div><div>
<br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#path-noscheme<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>segment-nz-nc *( "/" segment )</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>path_noscheme<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>( segment_nz_nc ( "/" segment )* ) $All;</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#path-rootless<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>segment-nz *( "/" segment )</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>path_rootless<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>( segment_nz ( "/" segment )* ) $All;</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#path-absolute<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>"/" [ segment-nz *( "/" segment ) ]</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>path_absolute<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>( "/" ( segment_nz ( "/" segment )* )? ) $All;</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#path-abempty<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>*( "/" segment )</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>path_abempty<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>( ( "/" segment )* ) $All;</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#path<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>path-abempty / path-absolute / path-noscheme / path-rootless / path-empty</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>path<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>path_abempty | path_absolute | path_noscheme | path_rootless | path_empty;</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#reg-name<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>*( unreserved / pct-encoded / sub-delims )</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>reg_name<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>( unreserved | pct_encoded | sub_delims )*;</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#IPv4address<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>dec-octet "." dec-octet "." dec-octet "." dec-octet</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>IPv4address<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>dec_octet "." dec_octet "." dec_octet "." dec_octet;</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#h16<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>1*4HEXDIG</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>h16<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>HEXDIG{1,4};</div><div><br>
</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#ls32<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>( h16 ":" h16 ) / IPv4address</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>ls32<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>( h16 ":" h16 ) | IPv4address;</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#IPv6address<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>( 6( h16 ":" ) ls32 ) / ( "::" 5( h16 ":" ) ls32 ) / ( [ h16 ] "::" 4( h16 ":" ) ls32 ) / ( [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 ) / ( [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 ) / ( [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 ) / ( [ *4( h16 ":" ) h16 ] "::" ls32 ) / ( [ *5( h16 ":" ) h16 ] "::" h16 ) / ( [ *6( h16 ":" ) h16 ] "::" )</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>IPv6address<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>( ( h16 ":" ){6} ls32 ) | ( "::" ( h16 ":" ){5} ls32 ) | ( h16? "::" ( h16 ":" ){4} ls32 ) | ( ( ( h16 ":" ){0,1} h16 )? "::" ( h16 ":" ){3} ls32 ) | ( ( ( h16 ":" ){0,2} h16 )? "::" ( h16 ":" ){2} ls32 ) | ( ( ( h16 ":" ){0,3} h16 )? "::" h16 ":" ls32 ) | ( ( ( h16 ":" ){0,4} h16 )? "::" ls32 ) | ( ( ( h16 ":" ){0,5} h16 )? "::" h16 ) | ( ( ( h16 ":" ){0,6} h16 )? "::" );</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#IPvFuture<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>"v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>IPvFuture<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>"v" HEXDIG+ "." ( unreserved | sub_delims | ":" )+;</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#IP-literal<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>"[" ( IPv6address / IPvFuture ) "]"</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>IP_literal<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>"[" ( IPv6address | IPvFuture ) "]";</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#port<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>*DIGIT</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>port<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>DIGIT*;</div><div><br></div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>#host<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>IP-literal / IPv4address / reg-name</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>host<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>IP_literal | IPv4address | reg_name;</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#userinfo<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>*( unreserved / pct-encoded / sub-delims / ":" )</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>userinfo<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>( unreserved | pct_encoded | sub_delims | ":" )*;</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#authority<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>[ userinfo "@" ] host [ ":" port ]</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>authority<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>( userinfo "@" )? host ( ":" port )?;</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#scheme<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>scheme<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>ALPHA ( ALPHA | DIGIT | "+" | "-" | "." )*;</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#relative-part<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>( "//" authority path-abempty ) / ( path-absolute ) / ( path-noscheme ) / ( path-empty )</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>relative_part<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>( "//" authority path_abempty ) | ( path_absolute ) | ( path_noscheme ) | ( path_empty );</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#relative-ref<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>relative-part [ "?" query ] [ "#" fragment ]</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>relative_ref<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>relative_part ( "?" query )? ( "#" fragment )?;</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#hier-part<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>( "//" authority path-abempty ) / ( path-absolute ) / ( path-rootless ) / ( path-empty )</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>hier_part<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>( "//" authority path_abempty ) | ( path_absolute) | ( path_rootless ) | ( path_empty );</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#absolute-URI<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>scheme ":" hier-part [ "?" query ]</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>absolute_URI<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>scheme ":" hier_part ( "?" query )?;</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#URI<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>scheme ":" hier-part [ "?" query ] [ "#" fragment ]</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>URI<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>scheme ":" hier_part ( "?" query )? ( "#" fragment )?;</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#URI-reference<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>URI / relative-ref</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>URI_reference<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre"> </span>URI | relative_ref;</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>main<span class="Apple-tab-span" style="white-space:pre"> </span>:=<span class="Apple-tab-span" style="white-space:pre"> </span>URI_reference | absolute_URI;</div>
<div>}%%</div></div><div>#-----------------------------------------------------------------------------------------------------
</div><div>I want to get the path from a uri, example as:</div><div>"<a href="http://www.complang.org/ragel/examples/clang.rl">http://www.complang.org/ragel/examples/clang.rl</a>"</div><div>should out put:</div>
<div>"/ragel/examples/clang.rl"</div><div>but i get:</div><div>"http//ragel/examples/clang.rl"</div><div><br></div><div>I have read the doc of ragel, but i don't know where i do wrong.</div><div>I have work on this problem several days :-(, so please give me some help, thanks very much :-)</div>
<div><br></div><div>ps.</div><div>my all need is to get some part information from a uri.</div><div>i have see XuLang's question in this maillist, but i want to implement a all rfc 3986 abnf, not only a common regex match.</div>
<div><br></div><div><br></div><div><br></div><div>-- <br><span style="font-family:arial,sans-serif;font-size:12px"><div><span style="font-family:arial,sans-serif;font-size:12px"><br></span></div></span><span style="font-family:arial,sans-serif;font-size:12px"><i>Regards,</i></span><div>
<span style="font-family:arial,sans-serif;font-size:12px"><div><b><i>Deng Pei</i></b></div><div><b><i><br></i></b></div><div><i>Software Engineering Institute</i></div><div><i>Email: <a href="mailto:dpcmain@gmail.com" target="_blank">dpcmain@gmail.com</a></i></div>
</span><span style="font-family:arial,sans-serif;font-size:12px"><i>Address: East China Normal University, Shanghai, China 200062</i></span></div><br>
</div>