Martin Mares <m...@ucw.cz> wrote on 2010/04/29 23:21:48:
>
> Hello!
>
> > Haven't you heard a word ? ECHO, REJECT and BEGIN are pre defined
> > actions in flex that you can use in your C code. Go read flex again.
>
> I know that. But what does that really means from the point of view
> of C syntax (as used in the C snippets contained in the C source)?
> Go read the C standard ;-)
>
> Does that mean that every occurrence of REJECT as a substring in the
> C code is interpreted by flex?

Not likely, but I have never tested that.

>
> Or does that mean an occurrence of REJECT as an identifier?
My money is on this one.

>
> Or as a C statement?
>
> Do you see any place in the flex doc which makes this clear?

No, but not so strange as flex/lex is way old.

>
> Historically, all dialects of lex I have ever seen define these constructs
> as C macros, so that they do not trigger in strings or in non-expanding
> macro parameters and it is possible to un-/redefine them. If flex suddenly
> started to scan the source for calls of these actions in a way which does
> not really respect C syntax, it is at least a breach of long tradition.
> Whether it is a breach of the specs, nobody can tell as the specs are
> utterly vague.

Well, it must respect C syntax, how else can one use them in the code?
Theoretically one could image that REJECT and friends are changed into
some inline function but it would be very unpopular I think.

Reply via email to