Uebungsaufgaben/Semester3/Java/Theoretische Informatik/browserlexer
2024-12-19 23:55:07 +01:00

63 lines
1.7 KiB
Plaintext

%%
%public
%class browserlexer
%type int
%eofval{
System.out.println("EOF reached");
return -1;
%eofval}
a = (a|A)
b = (b|B)
c = (c|C)
d = (d|D)
e = (e|E)
f = (f|F)
g = (g|G)
h = (h|H)
i = (i|I)
j = (j|J)
k = (k|K)
l = (l|L)
m = (m|M)
n = (n|N)
o = (o|O)
p = (p|P)
q = (q|Q)
r = (r|R)
s = (s|S)
t = (t|T)
u = (u|U)
v = (v|V)
w = (w|W)
x = (x|X)
y = (y|Y)
z = (z|Z)
ws = [ \t\r\n\b\015]+
%%
"<"(h|H)(t|T)(m|M)(l|L)">" { System.out.println(yytext()); }
"</"(h|H)(t|T)(m|M)(l|L)">" { System.out.println(yytext()); }
"<"(h|H){e}{a}{d}">" { System.out.println(yytext()); }
"</"(h|H){e}{a}{d}">" { System.out.println(yytext()); }
"<"(t|T){i}(t|T)(l|L){e}">" { System.out.println(yytext()); }
"</"(t|T){i}(t|T)(l|L){e}">" { System.out.println(yytext()); }
"<"{b}{o}{d}{y}">" { System.out.println(yytext()); }
"</"{b}{o}{d}{y}">" { System.out.println(yytext()); }
"<"{h}1">" { System.out.println(yytext()); }
"</"{h}1">" { System.out.println(yytext()); }
"<"{h}2">" { System.out.println(yytext()); }
"</"{h}2">" { System.out.println(yytext()); }
"<"{h}3">" { System.out.println(yytext()); }
"</"{h}3">" { System.out.println(yytext()); }
"<"{b}">" { System.out.println(yytext()); }
"</"{b}">" { System.out.println(yytext()); }
"<"{c}{e}{n}(t|T){e}{r}">" { System.out.println(yytext()); }
"</"{c}{e}{n}(t|T){e}{r}">" { System.out.println(yytext()); }
"<"{e}(m|M)">" { System.out.println(yytext()); }
"</"{e}(m|M)">" { System.out.println(yytext()); }
"<"{p}">" { System.out.println(yytext()); }
"</"{p}">" { System.out.println(yytext()); }
{ws} { System.out.println(yytext()); }
[^\<]+ { System.out.println(yytext()); }