Subversion Repositories programming

Rev

Rev 243 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
230 ira 1
/*******************************************************************************
2
 * File: robot.flex
3
 *
4
 * Copyright (c) 2006, Ira W. Snyder (devel@irasnyder.com)
5
 * License: GNU General Public License v2
6
 *
7
 * This file implements the scanner that reads the input for
8
 * the robot from Project #3, Question #2.
9
 ******************************************************************************/
10
 
11
%%
12
 
13
%byaccj
14
 
15
%{
16
    /* store a reference to the Parser object */
17
    private Parser yyparser;
18
 
19
    /* constructor taking an additional Parser object */
20
    public Yylex(java.io.Reader r, Parser yyparser)
21
    {
22
        this(r);
23
        this.yyparser = yyparser;
24
    }
25
%}
26
 
27
WSPACE = [\ \t]+ | \n | \r | \r\n
28
 
29
%%
30
 
31
"p"         { return Parser.PUT;        }
32
"t"         { return Parser.TAKE;       }
33
{WSPACE}    {                           }