Sorry I forgot to mention that you won't see any change in the dot
output, since in the visualization there is no difference between
to/char/from actions.

-Adrian

Hardik Parikh wrote:
> Hi Adrian
> 
> I tried to work out with your suggestion but seeing not any reflection in
> output. I am not able to understand where it is going wrong?
> 
> Thanks & Regards
> Hardik Parikh
> 
> -----Original Message-----
> From: Adrian Thurston [mailto:[email protected]] 
> Sent: Sunday, December 21, 2008 9:01 AM
> To: [email protected]
> Subject: Re: [ragel-users] Problem with tag comment implementation
> 
> Hi Hardik,
> 
> The problem here is very subtle. Conditions are executed before the 
> actions on the same character, so the test of stringcmp is running 
> before it is set. Change the embedding of tagend to a "to state" action 
> using:
> 
>  >to(tagend)
> 
> That should do it.
> 
> -Adrian
> 
> Hardik Parikh wrote:
>> Hi,
>>
>>  
>>
>>     I have requirement to consider following as valid comment in source 
>> language
>>
>>  
>>
>>     |abc#
>>
>>              Some description ...
>>
>>    #abc|
>>
>>  
>>
>>   And following is invalid comment
>>
>>  
>>
>>     |abc#
>>
>>              Some description ...
>>
>>     #xyz|
>>
>>  
>>
>> And for above requirement I need to capture token string and performed 
>> match operation as there is no inbuilt support for backward reference in 
>> ragel
>>
>> I tried out with following implementation
>>
>>  
>>
>> action mark_start{
>>
>>      start = fpc+1;
>>
>>     // printf(" Mark start at %c\n",fc);
>>
>>   }
>>
>>  action tagstart{
>>
>>     size_t len = fpc - start ;
>>
>>     s = calloc(len,sizeof(char));
>>
>>     strncpy(s,start,len);
>>
>>     s[len]='\0';
>>
>>   //  printf("Start : %s\n",s);
>>
>>   }
>>
>>  
>>
>>  action tagend{
>>
>>     size_t len = fpc - start ;
>>
>>     e = calloc(len,sizeof(char));
>>
>>     strncpy(e,start,len);
>>
>>     e[len]='\0';
>>
>>    stringcmp = strncmp(e,s,sizeof(s));
>>
>>     //printf("End : %s\n",e);
>>
>>   }
>>
>>  
>>
>>    curl_tag_comment =
>>
>>     '|'@mark_start (nonnewline - ws)* '#'@tagstart @comment(
>>
>>       newline %{ entity = INTERNAL_NL; } %curl_ccallback
>>
>>       |
>>
>>       ws
>>
>>       |
>>
>>       (nonnewline - ws) @comment
>>
>>     )* :>> ('#'@mark_start (nonnewline - ws)* '|' @tagend  when { 
>> stringcmp == 0}) @comment;
>>
>>  
>>
>>  
>>
>> Now I am able to capture both start and end substring properly and able 
>> to do math operation in when condition but it produces as a valid commet 
>> in parser for even a non valid statement.
>>
>>  
>>
>> Like
>>
>>  
>>
>> curl comment |abc#
>>
>> curl comment             Some  description ...
>>
>> curl comment  #xyz|
>>
>>  
>>
>> Please provide me any suggestions where I am doing something wrong or is 
>> there any other better way to implement the same.
>>
>>  
>>
>> Thanks & Regards
>>
>> Hardik Parikh
>>
>>  
>>
>> DISCLAIMER ========== This e-mail may contain privileged and 
>> confidential information which is the property of Persistent Systems 
>> Ltd. It is intended only for the use of the individual or entity to 
>> which it is addressed. If you are not the intended recipient, you are 
>> not authorized to read, retain, copy, print, distribute or use this 
>> message. If you have received this communication in error, please notify 
>> the sender and delete all copies of this message. Persistent Systems 
>> Ltd. does not accept any liability for virus infected mails.
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> ragel-users mailing list
>> [email protected]
>> http://www.complang.org/mailman/listinfo/ragel-users
> 
> _______________________________________________
> ragel-users mailing list
> [email protected]
> http://www.complang.org/mailman/listinfo/ragel-users
> 
> 
> DISCLAIMER
> ==========
> This e-mail may contain privileged and confidential information which is the 
> property of Persistent Systems Ltd. It is intended only for the use of the 
> individual or entity to which it is addressed. If you are not the intended 
> recipient, you are not authorized to read, retain, copy, print, distribute or 
> use this message. If you have received this communication in error, please 
> notify the sender and delete all copies of this message. Persistent Systems 
> Ltd. does not accept any liability for virus infected mails.
> 
> _______________________________________________
> ragel-users mailing list
> [email protected]
> http://www.complang.org/mailman/listinfo/ragel-users

_______________________________________________
ragel-users mailing list
[email protected]
http://www.complang.org/mailman/listinfo/ragel-users

Reply via email to