home *** CD-ROM | disk | FTP | other *** search
- { A program demonstrating Turbo Pascal 5.5's built in parsing }
- { Program parses a line and displays the individual words on seperate }
- { lines on the screen. }
- {$M 1024,0,0}
- {$A-,E-,L-,N-,R- }
- PROGRAM PARSE;
-
- USES CRT;
-
- CONST
- MESSAGE =
- 'Now is the time for all good men to code in 68-char columns.';
-
- TYPE
- PSTRING = STRING[128]; { Defines biggest parsable string }
- PPS = ^PSTRING; { This will point at Prog. Prefix }
-
- VAR
- PARSELINE : PPS;
- X : INTEGER;
- WORKSTR : STRING[40];
-
- BEGIN
- PARSELINE := PTR(PREFIXSEG,128); { Initialize pointer to work area }
- CLRSCR;
- WRITELN('MESSAGE: ',MESSAGE); { Show what is going to be parsed }
- PARSELINE^ := MESSAGE;
- FOR X := 1 TO PARAMCOUNT DO { Now display each of the pieces }
- WRITELN(PARAMSTR(X));
- READLN; { Let user acknowledge the display }
- END.
-
-
-