help-flex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: comments in lexical definitions


From: Tobias Ostgathe
Subject: Re: comments in lexical definitions
Date: Thu, 16 Aug 2001 14:21:29 +0200

----- Original Message -----
From: "W. L. Estes" <address@hidden>
To: <address@hidden>
Cc: <address@hidden>
Sent: Wednesday, July 18, 2001 11:30 PM
Subject: Re: comments in lexical definitions


> > I'm missing the possibility to include comments in lexical definition
files.
>
> Explain what you mean. Give examples of code where helpful.
Ok, there is an example at the end of the mail. I've used C++ comments for
the comments I am missing in lexical definition
files. The C++ syntax is just one possibility.
The whole thing could be realized via a preprocessor which removes the
comments and does not impact the rest
of the code.
I'm currently using an extra preprocessor which filters the files for flex
and writes the result in a temporary file for flex.
The used comments are simple C-comments which must begin at the line start.
Not very advanced but it was enough
for a first step.
However, this does not ease debugging very much. So I'm looking for a more
integrated solution.
>
> > I did not find a project home page, so I guess flex is currently not
developed
> > any more.
>
> flex is currently maintained. a new release is on the horizon but a
> lot of work needs to be done before it's ready to go out the door.
>
> > If my guess is right I'd like to do the changes myself.
>
> Patches are always welcome.
Can you give me a hint where to find the most recent code files.
Of course I will provide you the patch if you like it.
I would also appreciate tips for a clever comment syntax.

Some ideas:
1. the comments are enabled via a command line option
2. possible syntax
- C or C++ syntax (/* */, // \n)

Thank you for the prompt and friendly response

Tobias

Example:
---------
%{

/* this comment does not bother flex */

%}

%x simpleblock

%%

<INITIAL>
{
// entry for the simple rules
simplerules {
               push_state(simpleblock)
            }
}

// this block contains simple lexical definitions
<simpleblock>
{
// simplerule 1
simplerule1 {
               /* this comment does not bother flex */
               fprintf(stderr, "%s\n", yytext);
            }

// simplerule 2
simplerule1 {
               /* this comment does not bother flex */
               fprintf(stderr, "%s\n", yytext);
            }
}

%%

// this comment does not bother flex





reply via email to

[Prev in Thread] Current Thread [Next in Thread]