Subversion Repositories programming

Rev

Rev 280 | 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
 
281 ira 27
WSPACE  = [\ \t]+
28
NL      = \n | \r | \r\n
29
IGNORE  = [^ptPT\ \t\n\r]+
30
PUT     = [pP]
31
TAKE    = [tT]
280 ira 32
 
230 ira 33
%%
34
 
281 ira 35
{PUT}       { return Parser.PUT;        }
36
{TAKE}      { return Parser.TAKE;       }
243 ira 37
{NL}        { return Parser.NL;         }
230 ira 38
{WSPACE}    {                           }
280 ira 39
{IGNORE}    {                           }
243 ira 40