package yacs.parser;

import java_cup.runtime.Symbol;

%%

%cup
%public

ALPHA=[A-Za-z]
DIGIT=[0-9]

%%

";"                              { return new Symbol(sym.SEMI); }
","                              { return new Symbol(sym.COMMA); }
"="                              { return new Symbol(sym.EQUAL); }
"!="                             { return new Symbol(sym.NOT_EQUAL); }
">"                              { return new Symbol(sym.GREATER); }
"<"                              { return new Symbol(sym.LOWER); }
">="                             { return new Symbol(sym.GREATER_EQUAL); }
"<="                             { return new Symbol(sym.LOWER_EQUAL); }
"+"                              { return new Symbol(sym.PLUS); }
"-"                              { return new Symbol(sym.MINUS); }
"*"                              { return new Symbol(sym.TIMES); }
"/"                              { return new Symbol(sym.DIVIDE); }
"("                              { return new Symbol(sym.LPAREN); }
")"                              { return new Symbol(sym.RPAREN); }
"["                              { return new Symbol(sym.LBRACKET); }
"]"                              { return new Symbol(sym.RBRACKET); }
{DIGIT}+                         { return new Symbol(sym.NUMBER, new Integer(yytext())); }
{DIGIT}+"."{DIGIT}+              { return new Symbol(sym.FLOAT, new Double(yytext())); }
{ALPHA}({ALPHA}|{DIGIT}|_|".")*  { return new Symbol(sym.VARIABLE, yytext()); }
[ \t\r\n\f\b]                    { /* ignore white space. */ }
.                                { System.err.println("Illegal character: "+yytext()); }
