| 
 | 
Noeud:Exercises on Flex, Noeud «Previous»:Using Flex with the GNU Build System, Noeud «Up»:Scanning with Flex
0rradix:number.  Implement this mode in
ylscan.l.
csize, a simple program
performing statistics on C sources.  For instance running it on the
Yleval module gives:
$ csize -h yleval.h yleval.c ylscan.c ylparse.h ylparse.c
 total    blank lines w/   nb, nc    semi- preproc. file
 lines    lines comments    lines   colons  direct.
------+--------+--------+--------+--------+--------+----
    69       10       27       33        8        9 yleval.h
   237       35       37      165       60       13 yleval.c
  1730      296      279     1185      391      303 ylscan.c
    54        7        1       47        7       36 ylparse.h
  1290      178      237      915      288      279 ylparse.c
  3380      526      581     2345      754      640 total
switch.  Implement one such program, beswitch, thanks
to Flex.  beswitch must be a drop-in replacement of Gperf.
Your scanner must be better than that of Gperf, in particular, it shall
not be confused by /* %} */ or " %} " in the prologue. 
You are likely to need several start conditions, such as C_CODE,
PROLOGUE, COMMENT, STRING, etc.  The simple
BEGIN will no longer be sufficient, and you will probably need
some form of sub-scanner recursive calls: see %option stack,
yy_stack_push, and yy_stack_pop in (FIXME: Flex ref.).