{$optimize 7}{---------------------------------------------------------------}{ }{ Scanner }{ }{ External Variables: }{ }{ ch - next character to process }{ printMacroExpansions - print the token list? }{ reportEOL - report eolsy as a token? }{ token - next token to process }{ }{ External Subroutines: }{ }{ Error - flag an error }{ IsDefined - see if a macro name is in the macro table }{ InitScanner - initialize the scanner }{ NextCh - Read the next character from the file, skipping }{ comments. }{ NextToken - read the next token from the file }{ PutBackToken - place a token into the token stream }{ TermScanner - Shut down the scanner. }{ }{---------------------------------------------------------------}unitScanner;interface{$LibPrefix '0/obj/'}usesCCommon,Table,CGI,MM;{$segment 'scanner'}typepragmas={kinds of pragmas}(p_startofenum,p_cda,p_cdev,p_float,p_keep,p_nda,p_debug,p_lint,p_memorymodel,p_expand,p_optimize,p_stacksize,p_toolparms,p_databank,p_rtl,p_noroot,p_path,p_ignore,p_segment,p_nba,p_xcmd,p_unix,p_line,p_endofenum);{preprocessor types}{------------------}tokenListRecordPtr=^tokenListRecord;tokenListRecord=record{element of a list of tokens}next:tokenListRecordPtr;{next element in list}tokenString:longStringPtr;{string making up the token}token:tokenType;{token}expandEnabled:boolean;{can this token be macro expanded?}tokenStart,tokenEnd:ptr;{token start/end markers}end;macroRecordPtr=^macroRecord;macroRecord=record{preprocessor macro definition}next:macroRecordPtr;saved:boolean;name:stringPtr;parameters:integer;tokens:tokenListRecordPtr;readOnly:boolean;algorithm:integer;end;macroTable=array[0..hashSize]ofmacroRecordPtr;{preprocessor macro list}{path name lists}{---------------}pathRecordPtr=^pathRecord;pathRecord=recordnext:pathRecordPtr;path:stringPtr;end;varch:char;{next character to process}macros:^macroTable;{preprocessor macro list}pathList:pathRecordPtr;{additional search paths}printMacroExpansions:boolean;{print the token list?}reportEOL:boolean;{report eolsy as a token?}skipIllegalTokens:boolean;{skip flagging illegal tokens in skipped code?}slashSlashComments:boolean;{allow // comments?}token:tokenType;{next token to process}{---------------------------------------------------------------}procedureDoDefaultsDotH;{ Handle the defaults.h file }procedureError(err:integer);{ flag an error }{ }{ err - error number }{procedure Error2 (loc, err: integer); {debug}{ flag an error }{