1*30da1778Schristos /*
2*30da1778Schristos * This file is part of flex.
3*30da1778Schristos *
4*30da1778Schristos * Redistribution and use in source and binary forms, with or without
5*30da1778Schristos * modification, are permitted provided that the following conditions
6*30da1778Schristos * are met:
7*30da1778Schristos *
8*30da1778Schristos * 1. Redistributions of source code must retain the above copyright
9*30da1778Schristos * notice, this list of conditions and the following disclaimer.
10*30da1778Schristos * 2. Redistributions in binary form must reproduce the above copyright
11*30da1778Schristos * notice, this list of conditions and the following disclaimer in the
12*30da1778Schristos * documentation and/or other materials provided with the distribution.
13*30da1778Schristos *
14*30da1778Schristos * Neither the name of the University nor the names of its contributors
15*30da1778Schristos * may be used to endorse or promote products derived from this software
16*30da1778Schristos * without specific prior written permission.
17*30da1778Schristos *
18*30da1778Schristos * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
19*30da1778Schristos * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
20*30da1778Schristos * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21*30da1778Schristos * PURPOSE.
22*30da1778Schristos */
23*30da1778Schristos
24*30da1778Schristos #include "multiple_scanners_r_1.h"
25*30da1778Schristos #include "multiple_scanners_r_2.h"
26*30da1778Schristos
27*30da1778Schristos int
main(int argc,char ** argv)28*30da1778Schristos main ( int argc, char** argv )
29*30da1778Schristos {
30*30da1778Schristos (void)argc;
31*30da1778Schristos (void)argv;
32*30da1778Schristos
33*30da1778Schristos int S1_ok=1, S2_ok=1;
34*30da1778Schristos YY_BUFFER_STATE buff1, buff2;
35*30da1778Schristos yyscan_t scan1, scan2;
36*30da1778Schristos
37*30da1778Schristos S1_lex_init(&scan1);
38*30da1778Schristos S2_lex_init(&scan2);
39*30da1778Schristos
40*30da1778Schristos S1_set_out(stdout,scan1);
41*30da1778Schristos S2_set_out(S1_get_out(scan1),scan2);
42*30da1778Schristos
43*30da1778Schristos buff1 = S1__scan_string("foo on bar off", scan1);
44*30da1778Schristos buff2 = S2__scan_string("on blah blah off foo on bar off", scan2);
45*30da1778Schristos
46*30da1778Schristos /* scan simultaneously. */
47*30da1778Schristos while(S1_ok || S2_ok)
48*30da1778Schristos {
49*30da1778Schristos if (S1_ok)
50*30da1778Schristos S1_ok = S1_lex(scan1);
51*30da1778Schristos if (S2_ok)
52*30da1778Schristos S2_ok = S2_lex(scan2);
53*30da1778Schristos }
54*30da1778Schristos S1__delete_buffer(buff1, scan1);
55*30da1778Schristos S2__delete_buffer(buff2, scan2);
56*30da1778Schristos
57*30da1778Schristos S1_lex_destroy(scan1);
58*30da1778Schristos S2_lex_destroy(scan2);
59*30da1778Schristos printf("TEST RETURNING OK.\n");
60*30da1778Schristos return 0;
61*30da1778Schristos }
62*30da1778Schristos
63*30da1778Schristos
64*30da1778Schristos /* vim:set tabstop=8 softtabstop=4 shiftwidth=4: */
65