Rev 280 | Blame | Compare with Previous | Last modification | View Log | RSS feed
/*******************************************************************************
* File: robot.flex
*
* Copyright (c) 2006, Ira W. Snyder (devel@irasnyder.com)
* License: GNU General Public License v2
*
* This file implements the scanner that reads the input for
* the robot from Project #3, Question #2.
******************************************************************************/
%%
%byaccj
%{
/* store a reference to the Parser object */
private Parser yyparser;
/* constructor taking an additional Parser object */
public Yylex(java.io.Reader r, Parser yyparser)
{
this(r);
this.yyparser = yyparser;
}
%}
WSPACE = [\ \t]+
NL = \n | \r | \r\n
IGNORE = [^ptPT\ \t\n\r]+
PUT = [pP]
TAKE = [tT]
%%
{PUT} { return Parser.PUT; }
{TAKE} { return Parser.TAKE; }
{NL} { return Parser.NL; }
{WSPACE} { }
{IGNORE} { }