Advertisement
Abaduaber

TokGet

Sep 11th, 2014
519
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.82 KB | None | 0 0
  1. Procedure toTokGetter.tokGet;
  2. Var
  3.     I: tTokenType;
  4.     lSetP: t_SET_CharsP;
  5. Begin
  6.     If fwI > Length(fsStr) Then Begin
  7.       fType:= t_tEOL;
  8.       fsText:= Chr(13) + Chr(10);
  9.       Exit;
  10.     End;
  11.     fType:= t_tUnKnown;
  12.     fwBegI:= fwI;
  13.     For I:= t_tNone To t_tIdent Do With crBaseTokens[I] Do Begin
  14.       lSetP:= fSetP;
  15.       If lSetP = Nil Then Continue;
  16.       If lSetP^ = c_SET_IdentStartChars Then lSetP:= @c_SET_IdentChars;
  17.       Self.fType:= I;
  18.       If fsStr[fwI] In lSetP^ Then Begin
  19.         If Not (I In c_SET_TokGetAllTypes) Then Begin
  20.           Inc(fwI);
  21.           Break;
  22.         End;
  23.         While fsStr[fwI] In lSetP^ Do Inc(fwI);
  24.         Self.fsText:= Copy(fsStr, fwBegI, fwI - fwBegI);
  25.         If I = t_tValue Then Self.fValue:= sdwStrTo(Self.fsText);
  26.         Break;
  27.       End;
  28.     End;
  29. End;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement