|
Home > Archive > Unix Programming > April 2004 > flex default rule
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Daniel Haude 2004-04-26, 6:34 am |
| Hello,
I've written a simple lexer in flex that is supposed to pick only certain
parts of the input file and to ignore the (unmatched) rest. It works fine
except that it copies the unmatched stuff to stdout, as it's supposed
to. I got rid of that behavior by reassigning yyout appropriately, but I
was wondering if the "default rule" was somehow user accessible (meaning
that I'd like to write my own "action" for unmatched stuff instead of
automatically ECHOing to yyout).
Is this possible? Couldn't find anything in the docs.
Thanks,
--Daniel
--
"With me is nothing wrong! And with you?" (from r.a.m.p)
| |
| Nils O. Selåsdal 2004-04-26, 6:34 am |
| On Mon, 26 Apr 2004 09:56:29 +0000, Daniel Haude wrote:
> Hello,
> I've written a simple lexer in flex that is supposed to pick only certain
> parts of the input file and to ignore the (unmatched) rest. It works fine
> except that it copies the unmatched stuff to stdout, as it's supposed
> to. I got rid of that behavior by reassigning yyout appropriately, but I
> was wondering if the "default rule" was somehow user accessible (meaning
> that I'd like to write my own "action" for unmatched stuff instead of
> automatically ECHOing to yyout).
>
> Is this possible? Couldn't find anything in the docs.
Isnt this usually done by adding a "catch-all" rule that does nothing ?!
%%
your
rules
.. /* ignore anything else */
--
Nils Olav Selåsdal
System Engineer
w w w . u t e l s y s t e m s . c o m
| |
| Daniel Haude 2004-04-27, 5:33 am |
| On Mon, 26 Apr 2004 12:22:52 +0200,
Nils O Selåsdal <NOS@Utel.no> wrote
in Msg. <pan.2004.04.26.10.22.51.911874@Utel.no>
> Isnt this usually done by adding a "catch-all" rule that does nothing ?!
> %%
> your
> rules
> . /* ignore anything else */
Of course. Stupid me. I knew this was a classic case along the lines of
not seeing the forest because of all the trees.
--Daniel
--
"With me is nothing wrong! And with you?" (from r.a.m.p)
| |
| Daniel Haude 2004-04-27, 5:33 am |
| On 27 Apr 2004 09:34:11 GMT,
Daniel Haude <haude@physnet.uni-hamburg.de> wrote
in Msg. <slrnc8sa8j.cdk.haude@kir.physnet.uni-hamburg.de>
....but it's actually:
..|\n
"With me is nothing wrong! And with you?" (from r.a.m.p)
|
|
|
|
|