yylex.cod 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. (* lexical analyzer template (TP Lex V3.0), V1.0 3-2-91 AG *)
  2. (* global definitions: *)
  3. %%
  4. function yylex : Integer;
  5. procedure yyaction ( yyruleno : Integer );
  6. (* local definitions: *)
  7. %%
  8. begin
  9. (* actions: *)
  10. case yyruleno of
  11. %%
  12. end;
  13. end(*yyaction*);
  14. (* DFA table: *)
  15. %%
  16. var yyn : Integer;
  17. label start, scan, action;
  18. begin
  19. start:
  20. (* initialize: *)
  21. yynew;
  22. scan:
  23. (* mark positions and matches: *)
  24. for yyn := yykl[yystate] to yykh[yystate] do yymark(yyk[yyn]);
  25. for yyn := yymh[yystate] downto yyml[yystate] do yymatch(yym[yyn]);
  26. if yytl[yystate]>yyth[yystate] then goto action; (* dead state *)
  27. (* get next character: *)
  28. yyscan;
  29. (* determine action: *)
  30. yyn := yytl[yystate];
  31. while (yyn<=yyth[yystate]) and not (yyactchar in yyt[yyn].cc) do inc(yyn);
  32. if yyn>yyth[yystate] then goto action;
  33. (* no transition on yyactchar in this state *)
  34. (* switch to new state: *)
  35. yystate := yyt[yyn].s;
  36. goto scan;
  37. action:
  38. (* execute action: *)
  39. if yyfind(yyrule) then
  40. begin
  41. yyaction(yyrule);
  42. if yyreject then goto action;
  43. end
  44. else if not yydefault and yywrap() then
  45. begin
  46. yyclear;
  47. return(0);
  48. end;
  49. if not yydone then goto start;
  50. yylex := yyretval;
  51. end(*yylex*);