Subversion Repositories programming

Rev

Rev 230 | Rev 244 | Go to most recent revision | Details | Compare with Previous | 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
 
243 ira 27
WSPACE = [\ \t]+
28
NL = \n | \r | \r\n
230 ira 29
 
30
%%
31
 
32
"p"         { return Parser.PUT;        }
33
"t"         { return Parser.TAKE;       }
243 ira 34
"reset"     { return Parser.RESET;      }
35
{NL}        { return Parser.NL;         }
230 ira 36
{WSPACE}    {                           }
243 ira 37