Loading ...
Sorry, an error occurred while loading the content.

1686re2c and c-hilight, c-mode inside re2c comments

Expand Messages
  • Dr. Detlef Groth
    Nov 2 7:27 AM
      Hello all,

      I am using the great scanner tool re2c (regular expressions are
      converted to c-code.

      I would like that the code inside the re2c blocks (/*!re2c ... */)
      should be kept as c-mode:

      Example:
      int scan(Scanner *s){
      uchar *cursor = s->cur;
      int pos = 0 ;
      std:
      s->tok = cursor;
      /*!re2c
      any = [\000-\377];
      O = [0-7];
      */

      /*!re2c
      "BLAST"[XNP][ ]+[\.0-9]+ {
      printf("%s\n", YYTEXT) ;
      printf("s->fd=%i\n",(int)s->fd);
      printf("ftell %i\n", ftell(fdopen(s->fd,"r")));
      pos = ftell(fdopen(s->fd,"r")); pos -= s->top - s->tok ;
      printf("position: %i\n", pos);
      goto std;
      }
      "Query="[ ] {
      printf(" %i Pos=%s ",pos,YYTEXT);
      goto std ;
      }
      "\n" {
      if(cursor == s->eof) RET(EOI);
      s->pos = cursor; s->line++;
      goto std;
      }
      any { goto std; }
      */
      }

      I guess I have to modify the variable:
      .fhook-c.comment
      set-variable .fhook-c.comment "|/*| */|*| * | * |fr|"
      but how ?

      regards,
      Detlef
    • Show all 4 messages in this topic