/*-*** * * This file defines a lexical analyzer for the EJay language, which is an * extension of the Jay language defined in Section B.1 of the CSC 330 * textbook. The extensions that comprise EJay are defined in the writeup for * 330 Assignment 2. * */ import java_cup.runtime.*; %% /*-* * LEXICAL FUNCTIONS */ %cup %line %column %class EJayLexer %{ /** * Return a new Symbol with the given token id, and with the current line and * column numbers. */ Symbol newSym(int tokenId) { return new Symbol(tokenId, yyline, yycolumn); } /** * Return a new Symbol with the given token id, the current line and column * numbers, and the given token value. The value is used for tokens such as * identifiers and numbers. */ Symbol newSym(int tokenId, Object value) { return new Symbol(tokenId, yyline, yycolumn, value); } %} /*-* * PATTERN DEFINITIONS */ /******** PUT YOUR MACRO PATTERN DEFINITIONS HERE ********/ %% /** * LEXICAL RULES */ /******** PUT YOUR RULE/ACTION DEFINITIONS HERE ********/