xref: /minix3/external/bsd/flex/dist/tests/test-c++-multiple-scanners/scanner-2.l (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*357f1050SThomas Veerman  //  This file is part of flex.
2*357f1050SThomas Veerman  //
3*357f1050SThomas Veerman  //  Redistribution and use in source and binary forms, with or without
4*357f1050SThomas Veerman  //  modification, are permitted provided that the following conditions
5*357f1050SThomas Veerman  //  are met:
6*357f1050SThomas Veerman  //
7*357f1050SThomas Veerman  //  1. Redistributions of source code must retain the above copyright
8*357f1050SThomas Veerman  //     notice, this list of conditions and the following disclaimer.
9*357f1050SThomas Veerman  //  2. Redistributions in binary form must reproduce the above copyright
10*357f1050SThomas Veerman  //     notice, this list of conditions and the following disclaimer in the
11*357f1050SThomas Veerman  //     documentation and/or other materials provided with the distribution.
12*357f1050SThomas Veerman  //
13*357f1050SThomas Veerman  //  Neither the name of the University nor the names of its contributors
14*357f1050SThomas Veerman  //  may be used to endorse or promote products derived from this software
15*357f1050SThomas Veerman  //  without specific prior written permission.
16*357f1050SThomas Veerman  //
17*357f1050SThomas Veerman  //  THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
18*357f1050SThomas Veerman  //  IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
19*357f1050SThomas Veerman  //  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20*357f1050SThomas Veerman  //  PURPOSE.
21*357f1050SThomas Veerman 
22*357f1050SThomas Veerman %{
23*357f1050SThomas Veerman #include "config.h"
24*357f1050SThomas Veerman 
25*357f1050SThomas Veerman %}
26*357f1050SThomas Veerman 
27*357f1050SThomas Veerman %option 8bit outfile="scanner-2.cpp" prefix="S2_"
28*357f1050SThomas Veerman %option nounput nomain
29*357f1050SThomas Veerman %option warn stack noyy_top_state
30*357f1050SThomas Veerman 
31*357f1050SThomas Veerman %x OFF
32*357f1050SThomas Veerman %x ON
33*357f1050SThomas Veerman %%
34*357f1050SThomas Veerman <INITIAL>{
35*357f1050SThomas Veerman on    yy_push_state(ON); return 3;
36*357f1050SThomas Veerman off   yy_push_state(OFF); return 4;
37*357f1050SThomas Veerman .|\n  return 5;
38*357f1050SThomas Veerman }
39*357f1050SThomas Veerman <ON>.|\n  yy_pop_state(); return 6;
40*357f1050SThomas Veerman 
41*357f1050SThomas Veerman <OFF>.|\n yy_pop_state(); return 7;
42*357f1050SThomas Veerman %%
43*357f1050SThomas Veerman 
44*357f1050SThomas Veerman int S2_FlexLexer::yywrap()
45*357f1050SThomas Veerman {
46*357f1050SThomas Veerman     std::cout << "NOW WRAPPING." << std::endl;
47*357f1050SThomas Veerman     return 1;
48*357f1050SThomas Veerman }
49