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

Reply via email to