Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- UNIT MethodsReader;
- INTERFACE
- USES
- Types;
- CONST
- Letter = ['A' .. 'Z', 'a' .. 'z', 'А' .. 'Я', 'а' .. 'я', 'Ё', 'ё', '''', '-'];
- FUNCTION ReadLexem(VAR F: TEXT): LexemType;
- IMPLEMENTATION
- FUNCTION ReadLexem(VAR F: TEXT): LexemType;
- VAR
- Ch: CHAR;
- St: LexemType;
- N: INTEGER;
- BEGIN
- Ch := '#';
- St := '';
- WHILE NOT EOLN AND (Ch <> ' ')
- DO
- BEGIN
- READ(F, Ch);
- IF Ch IN Letter
- THEN
- St := St + Ch
- END;
- IF ((St[1] = '''') OR (St[1] = '-'))
- THEN
- DELETE(St, 1, 1);
- IF ((St[LENGTH(St)] = '''') OR (St[LENGTH(St)] = '-'))
- THEN
- DELETE(St, LENGTH(St), 1);
- ReadLexem := St
- END; {ReadLexem}
- BEGIN
- END. {UNIT MethodsReader}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement