[ragel-users] How to solve this Indetermination [SOLVED]

Adrian Thurston thurston at complang.org
Sat Feb 21 21:08:05 UTC 2009


Does that work okay with the following input?

sip:mydomain:45

I suspect it might not. The problem with this grammar is that you don't 
know what a colon after "sip:word" means. It could either end a host and 
start a port, or end a username and start a password. The presence of @ 
will tell you, as will one more chacter of lookahead (if a number then 
it's the former). This is where the one-pass model of ragel gets into 
trouble! You might want to try just recording what you see in the 
actions, but not doing anything about it until some action at the very 
end. At that time you can check which parts you have.

-Adrian

Iñaki Baz Castillo wrote:
> El Miércoles, 18 de Febrero de 2009, Iñaki Baz Castillo escribió:
> 
>> I really don't know why 'host' is set twice. I know that it's due to ( ":"
>> port )?. In case it doesn't exist in the grammar then 'host' is set just
>> once (with 'ibc:xxxx' value).
>>
>> Is there any trick to avoid this duplicate result? I've tryed everything I
>> know with no success.
>>
>> Thanks a lot foir any help.
> 
> Trying and trying I've got a solution:
> 
> BEFORE:
>   uri = "sip:" userinfo? host ( ":" port )? ;
> NOW:
>   uri = "sip:" ( userinfo? host ) <: ( ":" port )? ;
> 
> 
> :)
> 
> 




More information about the ragel-users mailing list