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

Re: [jasspa] re2c and c-hilight, c-mode inside re2c comments

Expand Messages
  • Thomas Hundt
    How strange. It almost seems like the comments should be around the re2c code, not the C code. This can t compile, the way it is. (ME would display it
    Message 1 of 4 , Nov 2, 2005
      How strange. It almost seems like the comments should be around the
      re2c code, not the C code. This can't compile, the way it is. (ME
      would display it properly if the comments were around the re2c code.)

      Is the rest of the code hilit as C? So, you want to change the comments
      NOT to display as comments?

      So you want to change this
      set-variable .fhook-c.comment "|/*| */|*| * | * |fr|"

      to something that matches only things other than "/*!re2c", like maybe
      this will work:
      set-variable .fhook-c.comment "|/*[!\!][!r][!e][!2][!c]| */|*| * |
      * |fr|"

      BTW the documentation is out of date on this variable. (The example has
      no 'r'.) And, in my copy, has some problem with the escape codes used
      -- instead of being hilighted, there are weird escape-like codes
      surrounding keywords. (I think it's not realizing that the snippet of
      ME macro code is ended, under .fhook-XXX.setup.)

      -Th



      Dr. Detlef Groth wrote:
      > 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
    • Phillips, Steven
      The .fhook-?.comment variables are used only for the reformatting of comments (typically bound to esc o ) and have no effect on either the indentation or
      Message 2 of 4 , Nov 2, 2005
        The .fhook-?.comment variables are used only for the reformatting of
        comments (typically bound to "esc o") and have no effect on either the
        indentation or hilighting rules.

        The hilighting of these comments can easily be changed by the hilight
        command as normal, but the indentation of C files is done by ME's build
        in C styler which is not aware of /*!re2c comments :(

        Steve

        > -----Original Message-----
        > From: jasspa@yahoogroups.com [mailto:jasspa@yahoogroups.com] On Behalf
        Of
        > Thomas Hundt
        > Sent: Wednesday, November 02, 2005 4:06 PM
        > To: jasspa@yahoogroups.com
        > Subject: Re: [jasspa] re2c and c-hilight, c-mode inside re2c comments
        >
        > How strange. It almost seems like the comments should be around the
        > re2c code, not the C code. This can't compile, the way it is. (ME
        > would display it properly if the comments were around the re2c code.)
        >
        > Is the rest of the code hilit as C? So, you want to change the
        comments
        > NOT to display as comments?
        >
        > So you want to change this
        > set-variable .fhook-c.comment "|/*| */|*| * | * |fr|"
        >
        > to something that matches only things other than "/*!re2c", like maybe
        > this will work:
        > set-variable .fhook-c.comment "|/*[!\!][!r][!e][!2][!c]| */|*| *
        |
        > * |fr|"
        >
        > BTW the documentation is out of date on this variable. (The example
        has
        > no 'r'.) And, in my copy, has some problem with the escape codes used
        > -- instead of being hilighted, there are weird escape-like codes
        > surrounding keywords. (I think it's not realizing that the snippet of
        > ME macro code is ended, under .fhook-XXX.setup.)
        >
        > -Th
        >
        >
        >
        > Dr. Detlef Groth wrote:
        > > 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
        >
        >
        > ------------------------ Yahoo! Groups Sponsor
        >
        >
        ________________________________________________________________________
        __
        >
        > This is an unmoderated list. JASSPA is not responsible for the content
        of
        > any material posted to this list.
        >
        > To unsubscribe, send a mail message to
        >
        > mailto:jasspa-unsubscribe@yahoogroups.com
        >
        > or visit http://groups.yahoo.com/group/jasspa and
        > modify your account settings manually.
        >
        >
        >
        > Yahoo! Groups Links
        >
        >
        >
        >
      • Tim O'Callaghan
        Hi,First, I d like to report a bug in the cygwin port of jasspa, which involves the spell checker. It seems not to recognize anything as being in the
        Message 3 of 4 , Nov 2, 2005
          Hi,

          First, I'd like to report a bug in the cygwin port of jasspa, which
          involves the spell checker. It seems not to recognize anything as
          being in the dictionary, while offering the word as a suggestion. So
          "do" suggests "do" etc.

          Any ideas?

          Tim.
          "However beautiful the strategy, you should occasionally look at the results."
          -- Winston Churchill


          ___________________________________________________________
          How much free photo storage do you get? Store your holiday
          snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com
        Your message has been successfully submitted and would be delivered to recipients shortly.