IMPLISTS.LST 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. Listing:
  2. 1 IMPLEMENTATION MODULE ImpLists;
  3. 2 (*
  4. 3 * REPERTOIRE
  5. 4 * Release 1.6
  6. 5 * By Charles Bradford and Cole Brecheen
  7. 6 * (c) Copyright 1985-1992 PMI
  8. 7 * Green Bay, Wisconsin
  9. 8 * All rights reserved
  10. 9 * (414) 468-6040
  11. 10 *
  12. 11 * $Header:
  13. 12 *)
  14. 13
  15. 14
  16. 15 IMPORT ErrorManager;
  17. 16 IMPORT GenLists;
  18. 17 IMPORT M2Strings;
  19. 18 IMPORT Parser;
  20. 19 IMPORT PosUtils;
  21. 20 IMPORT StrEdit;
  22. 21
  23. 22
  24. 23 PROCEDURE ExtractImportList( VAR TextList, Imports: GenLists.GenList;
  25. ***** ^ not supported yet
  26. 24 VAR StartOfImpList, EndOfImpList: CARDINAL );
  27. 25 VAR
  28. 26 x, CurrentWord, LastWord: ARRAY [0..79] OF CHAR;
  29. ***** ^ not supported yet
  30. ***** ^ not supported yet
  31. 27 Terminator: CHAR;
  32. 28 LineCnt, ColCnt: CARDINAL;
  33. 29
  34. 30 PROCEDURE LastWordWas( TheStr: ARRAY OF CHAR ): BOOLEAN;
  35. ***** ^ not supported yet
  36. 31 BEGIN
  37. 32 RETURN M2Strings.CompareStr( TheStr, LastWord ) = 0;
  38. ***** ^ not supported yet
  39. ***** ^ not supported yet
  40. ***** ^ not supported yet
  41. ***** ^ not supported yet
  42. 33 END LastWordWas;
  43. ***** ^ not supported yet
  44. 34
  45. 35
  46. 36 PROCEDURE CurrentWordIs( TheStr: ARRAY OF CHAR ): BOOLEAN;
  47. ***** ^ not supported yet
  48. 37 BEGIN
  49. 38 RETURN M2Strings.CompareStr( TheStr, CurrentWord ) = 0;
  50. ***** ^ not supported yet
  51. ***** ^ not supported yet
  52. ***** ^ not supported yet
  53. ***** ^ not supported yet
  54. 39 END CurrentWordIs;
  55. ***** ^ not supported yet
  56. 40
  57. 41 PROCEDURE NextWord( VAR TheStr: ARRAY OF CHAR );
  58. ***** ^ not supported yet
  59. 42 BEGIN
  60. 43 Parser.GetNextWord( TextList, LineCnt, ColCnt, TheStr, Terminator );
  61. ***** ^ not supported yet
  62. ***** ^ not supported yet
  63. ***** ^ not supported yet
  64. ***** ^ not supported yet
  65. ***** ^ not supported yet
  66. 44 M2Strings.Assign( CurrentWord, LastWord );
  67. ***** ^ not supported yet
  68. ***** ^ not supported yet
  69. ***** ^ not supported yet
  70. ***** ^ not supported yet
  71. 45 M2Strings.Assign( TheStr, CurrentWord );
  72. ***** ^ not supported yet
  73. ***** ^ not supported yet
  74. ***** ^ not supported yet
  75. ***** ^ not supported yet
  76. 46 END NextWord;
  77. ***** ^ not supported yet
  78. 47
  79. 48
  80. 49 PROCEDURE EndOfImports(): BOOLEAN;
  81. 50 BEGIN
  82. 51 IF CurrentWordIs( 'CONST' ) THEN
  83. ***** ^ not supported yet
  84. ***** ^ not supported yet
  85. 52 RETURN TRUE;
  86. 53 ELSIF CurrentWordIs( 'VAR' ) THEN
  87. ***** ^ not supported yet
  88. ***** ^ not supported yet
  89. 54 RETURN TRUE;
  90. 55 ELSIF CurrentWordIs( 'EXPORT' ) THEN
  91. ***** ^ not supported yet
  92. ***** ^ not supported yet
  93. 56 RETURN TRUE;
  94. 57 ELSIF CurrentWordIs( 'PROCEDURE' ) THEN
  95. ***** ^ not supported yet
  96. ***** ^ not supported yet
  97. 58 RETURN TRUE;
  98. 59 ELSIF CurrentWordIs( 'TYPE' ) THEN
  99. ***** ^ not supported yet
  100. ***** ^ not supported yet
  101. 60 RETURN TRUE;
  102. 61 ELSIF CurrentWordIs( 'BEGIN' ) THEN
  103. ***** ^ not supported yet
  104. ***** ^ not supported yet
  105. 62 RETURN TRUE;
  106. 63 ELSIF CurrentWordIs( 'END' ) THEN
  107. ***** ^ not supported yet
  108. ***** ^ not supported yet
  109. 64 RETURN TRUE;
  110. 65 ELSIF (LineCnt >= GenLists.ListLength(TextList)) THEN
  111. ***** ^ not supported yet
  112. ***** ^ not supported yet
  113. ***** ^ not supported yet
  114. 66 RETURN TRUE;
  115. 67 ELSE
  116. 68 RETURN FALSE;
  117. 69 END;
  118. 70 END EndOfImports;
  119. ***** ^ not supported yet
  120. 71
  121. 72 PROCEDURE EndOfStatement(): BOOLEAN;
  122. 73 BEGIN
  123. 74 RETURN PosUtils.Equal( x, 'FROM' ) OR PosUtils.Equal( x, 'IMPORT' ) OR
  124. ***** ^ not supported yet
  125. ***** ^ not supported yet
  126. ***** ^ not supported yet
  127. ***** ^ not supported yet
  128. ***** ^ not supported yet
  129. ***** ^ not supported yet
  130. ***** ^ not supported yet
  131. ***** ^ not supported yet
  132. 75 EndOfImports();
  133. ***** ^ not supported yet
  134. ***** ^ not supported yet
  135. 76 END EndOfStatement;
  136. ***** ^ not supported yet
  137. 77
  138. 78 VAR
  139. 79 SubList: GenLists.GenList;
  140. ***** ^ not supported yet
  141. 80 BEGIN
  142. 81 StrEdit.SetLength( Parser.TheLine, 0 );
  143. ***** ^ not supported yet
  144. ***** ^ not supported yet
  145. ***** ^ not supported yet
  146. ***** ^ not supported yet
  147. ***** ^ not supported yet
  148. 82 GenLists.NewList( Imports );
  149. ***** ^ not supported yet
  150. ***** ^ not supported yet
  151. ***** ^ not supported yet
  152. 83 LineCnt := 1;
  153. 84 ColCnt := 0;
  154. 85 StartOfImpList := 0;
  155. 86 EndOfImpList := 0;
  156. 87 LastWord := '';
  157. ***** ^ not supported yet
  158. ***** ^ incompatible assignment
  159. 88 CurrentWord := '';
  160. ***** ^ not supported yet
  161. ***** ^ incompatible assignment
  162. 89
  163. 90 REPEAT
  164. 91 NextWord( x );
  165. ***** ^ not supported yet
  166. ***** ^ not supported yet
  167. 92 IF EndOfImports() THEN
  168. ***** ^ not supported yet
  169. ***** ^ not supported yet
  170. 93 RETURN;
  171. 94 END;
  172. 95 UNTIL EndOfStatement();
  173. ***** ^ not supported yet
  174. ***** ^ not supported yet
  175. 96 StartOfImpList := LineCnt;
  176. 97 REPEAT
  177. 98 NextWord( x );
  178. ***** ^ not supported yet
  179. ***** ^ not supported yet
  180. 99 IF LastWordWas( 'FROM' ) THEN
  181. ***** ^ not supported yet
  182. ***** ^ not supported yet
  183. 100 GenLists.ListInsert( x, GenLists.StrCode, Imports, 65535 );
  184. ***** ^ not supported yet
  185. ***** ^ not supported yet
  186. ***** ^ not supported yet
  187. ***** ^ not supported yet
  188. ***** ^ not supported yet
  189. ***** ^ not supported yet
  190. ***** ^ not supported yet
  191. 101 (* Append module name to Imports. *)
  192. 102 GenLists.NewList( SubList );
  193. ***** ^ not supported yet
  194. ***** ^ not supported yet
  195. ***** ^ not supported yet
  196. 103 NextWord( x );
  197. ***** ^ not supported yet
  198. ***** ^ not supported yet
  199. 104 (* skip the 'IMPORT' *)
  200. 105 LOOP
  201. 106 NextWord( x );
  202. ***** ^ not supported yet
  203. ***** ^ not supported yet
  204. 107 IF EndOfStatement() THEN
  205. ***** ^ not supported yet
  206. ***** ^ not supported yet
  207. 108 EXIT;
  208. 109 ELSE
  209. 110 GenLists.ListInsert( x, GenLists.StrCode, SubList, 65535 );
  210. ***** ^ not supported yet
  211. ***** ^ not supported yet
  212. ***** ^ not supported yet
  213. ***** ^ not supported yet
  214. ***** ^ not supported yet
  215. ***** ^ not supported yet
  216. ***** ^ not supported yet
  217. 111 END;
  218. 112 END;
  219. 113 GenLists.ListInsert( SubList, GenLists.ListCode, Imports, 65535 );
  220. ***** ^ not supported yet
  221. ***** ^ not supported yet
  222. ***** ^ not supported yet
  223. ***** ^ not supported yet
  224. ***** ^ not supported yet
  225. ***** ^ not supported yet
  226. ***** ^ not supported yet
  227. 114 ELSIF LastWordWas( 'IMPORT' ) THEN
  228. ***** ^ not supported yet
  229. ***** ^ not supported yet
  230. 115 GenLists.ListInsert( x, GenLists.StrCode, Imports, 65535 );
  231. ***** ^ not supported yet
  232. ***** ^ not supported yet
  233. ***** ^ not supported yet
  234. ***** ^ not supported yet
  235. ***** ^ not supported yet
  236. ***** ^ not supported yet
  237. ***** ^ not supported yet
  238. 116 (* Append module name to Imports. *)
  239. 117 GenLists.NilList( SubList );
  240. ***** ^ not supported yet
  241. ***** ^ not supported yet
  242. ***** ^ not supported yet
  243. 118 GenLists.ListInsert( SubList, GenLists.ListCode, Imports, 65535 );
  244. ***** ^ not supported yet
  245. ***** ^ not supported yet
  246. ***** ^ not supported yet
  247. ***** ^ not supported yet
  248. ***** ^ not supported yet
  249. ***** ^ not supported yet
  250. ***** ^ not supported yet
  251. 119 (* Append nil SubList to indicated that this is a
  252. 120 FromLess import. *)
  253. 121 REPEAT
  254. 122 NextWord( x );
  255. ***** ^ not supported yet
  256. ***** ^ not supported yet
  257. 123 UNTIL EndOfStatement();
  258. ***** ^ not supported yet
  259. ***** ^ not supported yet
  260. 124 END;
  261. 125 UNTIL EndOfImports();
  262. ***** ^ not supported yet
  263. ***** ^ not supported yet
  264. 126 (*We've reached the end of the import list.*)
  265. 127 EndOfImpList := LineCnt - 1;
  266. 128 END ExtractImportList;
  267. ***** ^ not supported yet
  268. 129
  269. 130
  270. 131 END ImpLists.
  271. ***** ^ not supported yet
  272. 139 errors