manpagez: man pages & more
info flex
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

How can I match text only at the end of a file?

There is no way to write a rule which is “match this text, but only if it comes at the end of the file”. You can fake it, though, if you happen to have a character lying around that you don’t allow in your input. Then you redefine YY_INPUT to call your own routine which, if it sees an ‘EOF’, returns the magic character first (and remembers to return a real EOF next time it’s called). Then you could write:

<COMMENT>(.|\n)*{EOF_CHAR}    /* saw comment at EOF */

This document was generated on August 12, 2012 using texi2html 5.0.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.