Listing: 1 IMPLEMENTATION MODULE ImpLists; 2 (* 3 * REPERTOIRE 4 * Release 1.6 5 * By Charles Bradford and Cole Brecheen 6 * (c) Copyright 1985-1992 PMI 7 * Green Bay, Wisconsin 8 * All rights reserved 9 * (414) 468-6040 10 * 11 * $Header: 12 *) 13 14 15 IMPORT ErrorManager; 16 IMPORT GenLists; 17 IMPORT M2Strings; 18 IMPORT Parser; 19 IMPORT PosUtils; 20 IMPORT StrEdit; 21 22 23 PROCEDURE ExtractImportList( VAR TextList, Imports: GenLists.GenList; ***** ^ not supported yet 24 VAR StartOfImpList, EndOfImpList: CARDINAL ); 25 VAR 26 x, CurrentWord, LastWord: ARRAY [0..79] OF CHAR; ***** ^ not supported yet ***** ^ not supported yet 27 Terminator: CHAR; 28 LineCnt, ColCnt: CARDINAL; 29 30 PROCEDURE LastWordWas( TheStr: ARRAY OF CHAR ): BOOLEAN; ***** ^ not supported yet 31 BEGIN 32 RETURN M2Strings.CompareStr( TheStr, LastWord ) = 0; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 33 END LastWordWas; ***** ^ not supported yet 34 35 36 PROCEDURE CurrentWordIs( TheStr: ARRAY OF CHAR ): BOOLEAN; ***** ^ not supported yet 37 BEGIN 38 RETURN M2Strings.CompareStr( TheStr, CurrentWord ) = 0; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 39 END CurrentWordIs; ***** ^ not supported yet 40 41 PROCEDURE NextWord( VAR TheStr: ARRAY OF CHAR ); ***** ^ not supported yet 42 BEGIN 43 Parser.GetNextWord( TextList, LineCnt, ColCnt, TheStr, Terminator ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 44 M2Strings.Assign( CurrentWord, LastWord ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 45 M2Strings.Assign( TheStr, CurrentWord ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 46 END NextWord; ***** ^ not supported yet 47 48 49 PROCEDURE EndOfImports(): BOOLEAN; 50 BEGIN 51 IF CurrentWordIs( 'CONST' ) THEN ***** ^ not supported yet ***** ^ not supported yet 52 RETURN TRUE; 53 ELSIF CurrentWordIs( 'VAR' ) THEN ***** ^ not supported yet ***** ^ not supported yet 54 RETURN TRUE; 55 ELSIF CurrentWordIs( 'EXPORT' ) THEN ***** ^ not supported yet ***** ^ not supported yet 56 RETURN TRUE; 57 ELSIF CurrentWordIs( 'PROCEDURE' ) THEN ***** ^ not supported yet ***** ^ not supported yet 58 RETURN TRUE; 59 ELSIF CurrentWordIs( 'TYPE' ) THEN ***** ^ not supported yet ***** ^ not supported yet 60 RETURN TRUE; 61 ELSIF CurrentWordIs( 'BEGIN' ) THEN ***** ^ not supported yet ***** ^ not supported yet 62 RETURN TRUE; 63 ELSIF CurrentWordIs( 'END' ) THEN ***** ^ not supported yet ***** ^ not supported yet 64 RETURN TRUE; 65 ELSIF (LineCnt >= GenLists.ListLength(TextList)) THEN ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 66 RETURN TRUE; 67 ELSE 68 RETURN FALSE; 69 END; 70 END EndOfImports; ***** ^ not supported yet 71 72 PROCEDURE EndOfStatement(): BOOLEAN; 73 BEGIN 74 RETURN PosUtils.Equal( x, 'FROM' ) OR PosUtils.Equal( x, 'IMPORT' ) OR ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 75 EndOfImports(); ***** ^ not supported yet ***** ^ not supported yet 76 END EndOfStatement; ***** ^ not supported yet 77 78 VAR 79 SubList: GenLists.GenList; ***** ^ not supported yet 80 BEGIN 81 StrEdit.SetLength( Parser.TheLine, 0 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 82 GenLists.NewList( Imports ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 83 LineCnt := 1; 84 ColCnt := 0; 85 StartOfImpList := 0; 86 EndOfImpList := 0; 87 LastWord := ''; ***** ^ not supported yet ***** ^ incompatible assignment 88 CurrentWord := ''; ***** ^ not supported yet ***** ^ incompatible assignment 89 90 REPEAT 91 NextWord( x ); ***** ^ not supported yet ***** ^ not supported yet 92 IF EndOfImports() THEN ***** ^ not supported yet ***** ^ not supported yet 93 RETURN; 94 END; 95 UNTIL EndOfStatement(); ***** ^ not supported yet ***** ^ not supported yet 96 StartOfImpList := LineCnt; 97 REPEAT 98 NextWord( x ); ***** ^ not supported yet ***** ^ not supported yet 99 IF LastWordWas( 'FROM' ) THEN ***** ^ not supported yet ***** ^ not supported yet 100 GenLists.ListInsert( x, GenLists.StrCode, Imports, 65535 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 101 (* Append module name to Imports. *) 102 GenLists.NewList( SubList ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 103 NextWord( x ); ***** ^ not supported yet ***** ^ not supported yet 104 (* skip the 'IMPORT' *) 105 LOOP 106 NextWord( x ); ***** ^ not supported yet ***** ^ not supported yet 107 IF EndOfStatement() THEN ***** ^ not supported yet ***** ^ not supported yet 108 EXIT; 109 ELSE 110 GenLists.ListInsert( x, GenLists.StrCode, SubList, 65535 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 111 END; 112 END; 113 GenLists.ListInsert( SubList, GenLists.ListCode, Imports, 65535 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 114 ELSIF LastWordWas( 'IMPORT' ) THEN ***** ^ not supported yet ***** ^ not supported yet 115 GenLists.ListInsert( x, GenLists.StrCode, Imports, 65535 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 116 (* Append module name to Imports. *) 117 GenLists.NilList( SubList ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 118 GenLists.ListInsert( SubList, GenLists.ListCode, Imports, 65535 ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 119 (* Append nil SubList to indicated that this is a 120 FromLess import. *) 121 REPEAT 122 NextWord( x ); ***** ^ not supported yet ***** ^ not supported yet 123 UNTIL EndOfStatement(); ***** ^ not supported yet ***** ^ not supported yet 124 END; 125 UNTIL EndOfImports(); ***** ^ not supported yet ***** ^ not supported yet 126 (*We've reached the end of the import list.*) 127 EndOfImpList := LineCnt - 1; 128 END ExtractImportList; ***** ^ not supported yet 129 130 131 END ImpLists. ***** ^ not supported yet 139 errors