%%
%standalone
%class Calc
nl = \n|\r|\r\n
intNumber = [1-9][0-9]*
scientificNumbers = [+-]?\d(\.\d+)?[Ee][+-]?\d+
words = [A-Za-z]*\s
characters = [a-z]^[A-z]^[\s]
consonants = [b-df-hj-np-tv-z]
%%
{intNumber} {System.out.println("NUMBER: " +yytext());}
"if" {System.out.println("IF");}
"else" {System.out.println("ELSE");}
"√" {System.out.println("SQRT");}
"words" {System.out.println("WORDS");}
"characters" {System.out.println("CHARACTERS");}
"consonants" {System.out.println("CONSONANTS");}
"+" {System.out.println("PLUS");}
"-" {System.out.println("MINUS");}
"*" {System.out.println("STAR");}
"/" {System.out.println("DIV");}
"(" {System.out.println("OPEN_BRACKET");}
")" {System.out.println("CLOSE_BRACKET");}
"=" {System.out.println("EQUAL\n");}
{nl}|" "|\t {;}
. {System.out.println("Error: " + yytext());}
|