SCANNER.LST 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946
  1. Listing:
  2. 1 (* Release 3.10 *)
  3. 2 (*-------------------------------------------------------------------------*
  4. 3 * *
  5. 4 * SCANNER.MOD - COMMS Toolkit script file scanner *
  6. 5 * *
  7. 6 * COPYRIGHT (C) 1988..1992 Clarion Software Corporation. *
  8. 7 * All Rights Reserved *
  9. 8 * *
  10. 9 *--------------------------------------------------------------------------*)
  11. 10
  12. 11 (*# check(range=>off,overflow=>off,index=>off)*)
  13. 12 IMPLEMENTATION MODULE Scanner;
  14. 13 IMPORT Lib,Str,IO,Window;
  15. 14 FROM Window IMPORT Color;
  16. ***** ^ duplicate identifier
  17. 15
  18. 16 CONST
  19. 17 MaxResWords = 70;
  20. 18 TAB = 11C;
  21. 19 ErrWin = Window.WinDef(5,5,74,19,White,Red,TRUE,FALSE,FALSE,TRUE,Window.SingleFrame,White,Red);
  22. ***** ^ not supported yet
  23. ***** ^ not supported yet
  24. ***** ^ undeclared identifier
  25. ***** ^ undeclared identifier
  26. ***** ^ not supported yet
  27. ***** ^ not supported yet
  28. ***** ^ undeclared identifier
  29. ***** ^ undeclared identifier
  30. 20
  31. 21 TYPE
  32. 22 LineBuff = ARRAY[0..255] OF CHAR;
  33. ***** ^ not supported yet
  34. ***** ^ not supported yet
  35. 23 ResWordRec = RECORD
  36. 24 WordId : ARRAY[0..20] OF CHAR;
  37. ***** ^ not supported yet
  38. ***** ^ not supported yet
  39. 25 RSy : Symbols;
  40. ***** ^ undeclared identifier
  41. 26 END;
  42. ***** ^ not supported yet
  43. 27
  44. 28 VAR
  45. 29 Ch : CHAR;
  46. 30 FirstSymOnLine : BOOLEAN;
  47. 31 Stdwords,Lnth,Max : CARDINAL;
  48. 32 TokenPos,LineLength,
  49. 33 LineIndex,LineNumber: CARDINAL;
  50. 34 History : ARRAY[0..3] OF LineBuff;
  51. ***** ^ not supported yet
  52. ***** ^ not supported yet
  53. 35 CurrentLine : LineBuff;
  54. ***** ^ not supported yet
  55. 36 Reswords : ARRAY[0..MaxResWords-1] OF ResWordRec;
  56. ***** ^ not supported yet
  57. ***** ^ not supported yet
  58. 37
  59. 38 (*................................................*)
  60. 39
  61. 40 PROCEDURE ShowTokenPos;
  62. 41 VAR
  63. 42 i : CARDINAL;
  64. 43 Blank : LineBuff;
  65. ***** ^ not supported yet
  66. 44 BEGIN
  67. 45 FOR i:=0 TO 3 DO
  68. 46 IO.WrStr(History[i]);
  69. ***** ^ not supported yet
  70. ***** ^ not supported yet
  71. ***** ^ not supported yet
  72. ***** ^ not supported yet
  73. 47 IO.WrLn;
  74. ***** ^ not supported yet
  75. ***** ^ not supported yet
  76. 48 END;
  77. 49 IF TokenPos<=80 THEN
  78. 50 CurrentLine[LineLength] := 0C;
  79. ***** ^ not supported yet
  80. ***** ^ not supported yet
  81. 51 IO.WrStr(CurrentLine);
  82. ***** ^ not supported yet
  83. ***** ^ not supported yet
  84. ***** ^ not supported yet
  85. 52 IO.WrLn;
  86. ***** ^ not supported yet
  87. ***** ^ not supported yet
  88. 53 IF TokenPos>0 THEN
  89. 54 Lib.Fill(ADR(Blank),TokenPos,' ');
  90. ***** ^ not supported yet
  91. ***** ^ not supported yet
  92. ***** ^ undeclared identifier
  93. ***** ^ not supported yet
  94. ***** ^ not supported yet
  95. 55 END;
  96. 56 Blank[TokenPos]:='^';
  97. ***** ^ not supported yet
  98. ***** ^ not supported yet
  99. 57 Blank[TokenPos+1]:=0C;
  100. ***** ^ not supported yet
  101. ***** ^ not supported yet
  102. 58 IO.WrStr(Blank);
  103. ***** ^ not supported yet
  104. ***** ^ not supported yet
  105. ***** ^ not supported yet
  106. 59 IO.WrLn;
  107. ***** ^ not supported yet
  108. ***** ^ not supported yet
  109. 60 END;
  110. 61 END ShowTokenPos;
  111. ***** ^ not supported yet
  112. 62
  113. 63 (*................................................*)
  114. 64
  115. 65 PROCEDURE WriteCard(c:CARDINAL);
  116. 66 BEGIN
  117. 67 IF c>9 THEN
  118. 68 WriteCard(c DIV 10);
  119. ***** ^ not supported yet
  120. ***** ^ not supported yet
  121. 69 END;
  122. 70 IO.WrChar(CHR((c MOD 10)+48));
  123. ***** ^ not supported yet
  124. ***** ^ not supported yet
  125. ***** ^ undeclared identifier
  126. ***** ^ not supported yet
  127. 71 END WriteCard;
  128. ***** ^ not supported yet
  129. 72
  130. 73 (*................................................*)
  131. 74
  132. 75 PROCEDURE Error(Errnum:CARDINAL);
  133. 76 VAR
  134. 77 Ch : CHAR;
  135. 78 Err : Window.WinType;
  136. ***** ^ not supported yet
  137. 79 s : ARRAY[0..79] OF CHAR;
  138. ***** ^ not supported yet
  139. ***** ^ not supported yet
  140. 80 BEGIN
  141. 81 IF GotError THEN
  142. ***** ^ undeclared identifier
  143. 82 RETURN;
  144. 83 END;
  145. 84 Err := Window.Open(ErrWin);
  146. ***** ^ not supported yet
  147. ***** ^ not supported yet
  148. ***** ^ not supported yet
  149. ***** ^ not supported yet
  150. 85 Window.GotoXY(1,2);
  151. ***** ^ not supported yet
  152. ***** ^ not supported yet
  153. ***** ^ not supported yet
  154. 86 ShowTokenPos;
  155. ***** ^ not supported yet
  156. 87 IO.WrLn;
  157. ***** ^ not supported yet
  158. ***** ^ not supported yet
  159. 88 IO.WrStr('Error ');
  160. ***** ^ not supported yet
  161. ***** ^ not supported yet
  162. ***** ^ not supported yet
  163. 89 WriteCard(Errnum);
  164. ***** ^ not supported yet
  165. ***** ^ not supported yet
  166. 90 IO.WrStr(': ');
  167. ***** ^ not supported yet
  168. ***** ^ not supported yet
  169. ***** ^ not supported yet
  170. 91 CASE Errnum OF
  171. 92 1 : s:='String constant must not exceed source line';|
  172. ***** ^ not supported yet
  173. ***** ^ not supported yet
  174. 93 2 : s:='Illegal char in text'; |
  175. ***** ^ not supported yet
  176. ***** ^ not supported yet
  177. 94 3 : s:='This Symbol not expected here'; |
  178. ***** ^ not supported yet
  179. ***** ^ not supported yet
  180. 95 4 : s:='Value too large! (max 255)'; |
  181. ***** ^ not supported yet
  182. ***** ^ not supported yet
  183. 96 5 : s:='String variable expected'; |
  184. ***** ^ not supported yet
  185. ***** ^ not supported yet
  186. 97 6 : s:='String or String variable expected'; |
  187. ***** ^ not supported yet
  188. ***** ^ not supported yet
  189. 98 7 : s:='Value out of range'; |
  190. ***** ^ not supported yet
  191. ***** ^ not supported yet
  192. 99 8 : s:='Parameter Missing'; |
  193. ***** ^ not supported yet
  194. ***** ^ not supported yet
  195. 100 9 : s:='DIAL command not supported.'; |
  196. ***** ^ not supported yet
  197. ***** ^ not supported yet
  198. 101 10 : s:='Unknown File Protocol'; |
  199. ***** ^ not supported yet
  200. ***** ^ not supported yet
  201. 102 11 : s:='Label already defined!'; |
  202. ***** ^ not supported yet
  203. ***** ^ not supported yet
  204. 103 12 : s:='Label or Statement expected'; |
  205. ***** ^ not supported yet
  206. ***** ^ not supported yet
  207. 104 13 : s:='Label name expected'; |
  208. ***** ^ not supported yet
  209. ***** ^ not supported yet
  210. 105 14 : s:='Switch statement must have only one default!';|
  211. ***** ^ not supported yet
  212. ***** ^ not supported yet
  213. 106 15 : s:='Could not open Script file.'; |
  214. ***** ^ not supported yet
  215. ***** ^ not supported yet
  216. 107 ELSE
  217. 108 s:='Unknown error (program bug)';
  218. ***** ^ not supported yet
  219. ***** ^ not supported yet
  220. 109 END;
  221. 110 IO.WrStr(s);
  222. ***** ^ not supported yet
  223. ***** ^ not supported yet
  224. ***** ^ not supported yet
  225. 111 IO.WrLn;
  226. ***** ^ not supported yet
  227. ***** ^ not supported yet
  228. 112 IO.WrLn;
  229. ***** ^ not supported yet
  230. ***** ^ not supported yet
  231. 113 IO.WrStr('Press any key...');
  232. ***** ^ not supported yet
  233. ***** ^ not supported yet
  234. ***** ^ not supported yet
  235. 114 Ch:=IO.RdKey();
  236. ***** ^ not supported yet
  237. ***** ^ not supported yet
  238. ***** ^ not supported yet
  239. 115 Window.Close(Err);
  240. ***** ^ not supported yet
  241. ***** ^ not supported yet
  242. ***** ^ not supported yet
  243. 116 GotError := TRUE;
  244. ***** ^ undeclared identifier
  245. 117 END Error;
  246. ***** ^ not supported yet
  247. 118
  248. 119 (*................................................*)
  249. 120
  250. 121 PROCEDURE StrCompare(VAR S1,S2:ARRAY OF CHAR):INTEGER;
  251. ***** ^ not supported yet
  252. 122 VAR
  253. 123 i,Chrs,Lnth1,Lnth2,
  254. 124 diff : INTEGER;
  255. 125 Ch1,Ch2 : CHAR;
  256. 126 BEGIN
  257. 127 Lnth1:=Str.Length(S1);
  258. ***** ^ not supported yet
  259. ***** ^ not supported yet
  260. ***** ^ not supported yet
  261. 128 Lnth2:=Str.Length(S2);
  262. ***** ^ not supported yet
  263. ***** ^ not supported yet
  264. ***** ^ not supported yet
  265. 129 IF Lnth1>8 THEN
  266. 130 Lnth1:=8;
  267. 131 END;
  268. 132 IF Lnth2>8 THEN
  269. 133 Lnth2:=8;
  270. 134 END;
  271. 135 diff := Lnth1-Lnth2;
  272. 136 IF Lnth1<Lnth2 THEN
  273. 137 Chrs:=Lnth1;
  274. 138 ELSE
  275. 139 Chrs:=Lnth2;
  276. 140 END;
  277. 141 i:=0;
  278. 142 WHILE i<Chrs DO
  279. 143 Ch1:=CAP(S1[i]);
  280. ***** ^ undeclared identifier
  281. ***** ^ not supported yet
  282. ***** ^ not supported yet
  283. 144 Ch2:=CAP(S2[i]);
  284. ***** ^ undeclared identifier
  285. ***** ^ not supported yet
  286. ***** ^ not supported yet
  287. 145 IF Ch1<>Ch2 THEN
  288. 146 RETURN INTEGER(ORD(Ch1))-INTEGER(ORD(Ch2));
  289. ***** ^ undeclared identifier
  290. ***** ^ not supported yet
  291. ***** ^ undeclared identifier
  292. ***** ^ not supported yet
  293. 147 END;
  294. 148 INC(i);
  295. ***** ^ undeclared identifier
  296. ***** ^ not supported yet
  297. 149 END;
  298. 150 RETURN diff;
  299. 151 END StrCompare;
  300. ***** ^ not supported yet
  301. 152
  302. 153 (*.................................................*)
  303. 154
  304. 155 PROCEDURE InitSymbolTable;
  305. 156
  306. 157 (*. . . . . . . . . . . . . . . . . . . . . . . . .*)
  307. 158
  308. 159 PROCEDURE Symbol(Tipe:Symbols; Name:ARRAY OF CHAR);
  309. ***** ^ undeclared identifier
  310. ***** ^ not supported yet
  311. 160 BEGIN
  312. 161 WITH Reswords[Stdwords] DO
  313. ***** ^ not supported yet
  314. ***** ^ not supported yet
  315. 162 Lib.Move(ADR(Name),ADR(WordId),Str.Length(Name)+1);
  316. ***** ^ not supported yet
  317. ***** ^ not supported yet
  318. ***** ^ undeclared identifier
  319. ***** ^ not supported yet
  320. ***** ^ undeclared identifier
  321. ***** ^ undeclared identifier
  322. ***** ^ not supported yet
  323. ***** ^ not supported yet
  324. ***** ^ not supported yet
  325. ***** ^ not supported yet
  326. 163 RSy:=Tipe;
  327. ***** ^ undeclared identifier
  328. ***** ^ not supported yet
  329. 164 END;
  330. ***** ^ not supported yet
  331. 165 INC(Stdwords);
  332. ***** ^ undeclared identifier
  333. ***** ^ not supported yet
  334. 166 END Symbol;
  335. ***** ^ not supported yet
  336. 167
  337. 168 (*. . . . . . . . . . . . . . . . . . . . . . . . .*)
  338. 169
  339. 170 BEGIN (* InitSymbolTable *)
  340. 171 Stdwords := 0;
  341. 172 (* NOTE: because I was too lazy to include a sort procedure to be *)
  342. 173 (* used once only, the words in this reserved word table have been *)
  343. 174 (* manually entered in alphabetical order. Be careful when adding *)
  344. 175 (* new words! *)
  345. 176 Symbol(AlarmSy,'ALARM');
  346. ***** ^ undeclared identifier
  347. ***** ^ undeclared identifier
  348. ***** ^ not supported yet
  349. 177 Symbol(FTAscii,'ASCII');
  350. ***** ^ undeclared identifier
  351. ***** ^ undeclared identifier
  352. ***** ^ not supported yet
  353. 178 Symbol(AssignSy,'ASSIGN');
  354. ***** ^ undeclared identifier
  355. ***** ^ undeclared identifier
  356. ***** ^ not supported yet
  357. 179 Symbol(BreakSy,'BREAK');
  358. ***** ^ undeclared identifier
  359. ***** ^ undeclared identifier
  360. ***** ^ not supported yet
  361. 180 Symbol(FTBYmodem,'BYMODEM');
  362. ***** ^ undeclared identifier
  363. ***** ^ undeclared identifier
  364. ***** ^ not supported yet
  365. 181 Symbol(CaseSy,'CASE');
  366. ***** ^ undeclared identifier
  367. ***** ^ undeclared identifier
  368. ***** ^ not supported yet
  369. 182 Symbol(ChDirSy,'CHDIR');
  370. ***** ^ undeclared identifier
  371. ***** ^ undeclared identifier
  372. ***** ^ not supported yet
  373. 183 Symbol(ClearSy,'CLEAR');
  374. ***** ^ undeclared identifier
  375. ***** ^ undeclared identifier
  376. ***** ^ not supported yet
  377. 184 Symbol(CloseSy,'CLOSE');
  378. ***** ^ undeclared identifier
  379. ***** ^ undeclared identifier
  380. ***** ^ not supported yet
  381. 185 Symbol(ConnectSy,'CONNECTED');
  382. ***** ^ undeclared identifier
  383. ***** ^ undeclared identifier
  384. ***** ^ not supported yet
  385. 186 Symbol(CWhenSy,'CWHEN');
  386. ***** ^ undeclared identifier
  387. ***** ^ undeclared identifier
  388. ***** ^ not supported yet
  389. 187 Symbol(DefaultSy,'DEFAULT');
  390. ***** ^ undeclared identifier
  391. ***** ^ undeclared identifier
  392. ***** ^ not supported yet
  393. 188 Symbol(DialSy,'DIAL');
  394. ***** ^ undeclared identifier
  395. ***** ^ undeclared identifier
  396. ***** ^ not supported yet
  397. 189 Symbol(DosSy,'DOS');
  398. ***** ^ undeclared identifier
  399. ***** ^ undeclared identifier
  400. ***** ^ not supported yet
  401. 190 Symbol(ElseSy,'ELSE');
  402. ***** ^ undeclared identifier
  403. ***** ^ undeclared identifier
  404. ***** ^ not supported yet
  405. 191 Symbol(EmulateSy,'EMULATE');
  406. ***** ^ undeclared identifier
  407. ***** ^ undeclared identifier
  408. ***** ^ not supported yet
  409. 192 Symbol(EndCaseSy,'ENDCASE');
  410. ***** ^ undeclared identifier
  411. ***** ^ undeclared identifier
  412. ***** ^ not supported yet
  413. 193 Symbol(EndifSy,'ENDIF');
  414. ***** ^ undeclared identifier
  415. ***** ^ undeclared identifier
  416. ***** ^ not supported yet
  417. 194 Symbol(EndSwitchSy,'ENDSWITCH');
  418. ***** ^ undeclared identifier
  419. ***** ^ undeclared identifier
  420. ***** ^ not supported yet
  421. 195 Symbol(ExecuteSy,'EXECUTE');
  422. ***** ^ undeclared identifier
  423. ***** ^ undeclared identifier
  424. ***** ^ not supported yet
  425. 196 Symbol(ExitSy,'EXIT');
  426. ***** ^ undeclared identifier
  427. ***** ^ undeclared identifier
  428. ***** ^ not supported yet
  429. 197 Symbol(FailureSy,'FAILURE');
  430. ***** ^ undeclared identifier
  431. ***** ^ undeclared identifier
  432. ***** ^ not supported yet
  433. 198 Symbol(FindSy,'FIND');
  434. ***** ^ undeclared identifier
  435. ***** ^ undeclared identifier
  436. ***** ^ not supported yet
  437. 199 Symbol(FoundSy,'FOUND');
  438. ***** ^ undeclared identifier
  439. ***** ^ undeclared identifier
  440. ***** ^ not supported yet
  441. 200 Symbol(GetSy,'GET');
  442. ***** ^ undeclared identifier
  443. ***** ^ undeclared identifier
  444. ***** ^ not supported yet
  445. 201 Symbol(GetFileSy,'GETFILE');
  446. ***** ^ undeclared identifier
  447. ***** ^ undeclared identifier
  448. ***** ^ not supported yet
  449. 202 Symbol(GosubSy,'GOSUB');
  450. ***** ^ undeclared identifier
  451. ***** ^ undeclared identifier
  452. ***** ^ not supported yet
  453. 203 Symbol(GotoSy,'GOTO');
  454. ***** ^ undeclared identifier
  455. ***** ^ undeclared identifier
  456. ***** ^ not supported yet
  457. 204 Symbol(HangupSy,'HANGUP');
  458. ***** ^ undeclared identifier
  459. ***** ^ undeclared identifier
  460. ***** ^ not supported yet
  461. 205 Symbol(HostSy,'HOST');
  462. ***** ^ undeclared identifier
  463. ***** ^ undeclared identifier
  464. ***** ^ not supported yet
  465. 206 Symbol(IfSy,'IF');
  466. ***** ^ undeclared identifier
  467. ***** ^ undeclared identifier
  468. ***** ^ not supported yet
  469. 207 Symbol(IsFileSy,'ISFILE');
  470. ***** ^ undeclared identifier
  471. ***** ^ undeclared identifier
  472. ***** ^ not supported yet
  473. 208 Symbol(FTKermit,'KERMIT');
  474. ***** ^ undeclared identifier
  475. ***** ^ undeclared identifier
  476. ***** ^ not supported yet
  477. 209 Symbol(KermServSy,'KERMSERV');
  478. ***** ^ undeclared identifier
  479. ***** ^ undeclared identifier
  480. ***** ^ not supported yet
  481. 210 Symbol(KFlushSy,'KFLUSH');
  482. ***** ^ undeclared identifier
  483. ***** ^ undeclared identifier
  484. ***** ^ not supported yet
  485. 211 Symbol(LinkedSy,'LINKED');
  486. ***** ^ undeclared identifier
  487. ***** ^ undeclared identifier
  488. ***** ^ not supported yet
  489. 212 Symbol(LocateSy,'LOCATE');
  490. ***** ^ undeclared identifier
  491. ***** ^ undeclared identifier
  492. ***** ^ not supported yet
  493. 213 Symbol(LogSy,'LOG');
  494. ***** ^ undeclared identifier
  495. ***** ^ undeclared identifier
  496. ***** ^ not supported yet
  497. 214 Symbol(MacroSy,'MACRO');
  498. ***** ^ undeclared identifier
  499. ***** ^ undeclared identifier
  500. ***** ^ not supported yet
  501. 215 Symbol(MessageSy,'MESSAGE');
  502. ***** ^ undeclared identifier
  503. ***** ^ undeclared identifier
  504. ***** ^ not supported yet
  505. 216 Symbol(MGetSy,'MGET');
  506. ***** ^ undeclared identifier
  507. ***** ^ undeclared identifier
  508. ***** ^ not supported yet
  509. 217 Symbol(MLoadSy,'MLOAD');
  510. ***** ^ undeclared identifier
  511. ***** ^ undeclared identifier
  512. ***** ^ not supported yet
  513. 218 Symbol(NotSy,'NOT');
  514. ***** ^ undeclared identifier
  515. ***** ^ undeclared identifier
  516. ***** ^ not supported yet
  517. 219 Symbol(OffSy,'OFF');
  518. ***** ^ undeclared identifier
  519. ***** ^ undeclared identifier
  520. ***** ^ not supported yet
  521. 220 Symbol(OnSy,'ON');
  522. ***** ^ undeclared identifier
  523. ***** ^ undeclared identifier
  524. ***** ^ not supported yet
  525. 221 Symbol(OpenSy,'OPEN');
  526. ***** ^ undeclared identifier
  527. ***** ^ undeclared identifier
  528. ***** ^ not supported yet
  529. 222 Symbol(PauseSy,'PAUSE');
  530. ***** ^ undeclared identifier
  531. ***** ^ undeclared identifier
  532. ***** ^ not supported yet
  533. 223 Symbol(PrinterSy,'PRINTER');
  534. ***** ^ undeclared identifier
  535. ***** ^ undeclared identifier
  536. ***** ^ not supported yet
  537. 224 Symbol(QuitSy,'QUIT');
  538. ***** ^ undeclared identifier
  539. ***** ^ undeclared identifier
  540. ***** ^ not supported yet
  541. 225 Symbol(ResumeSy,'RESUME');
  542. ***** ^ undeclared identifier
  543. ***** ^ undeclared identifier
  544. ***** ^ not supported yet
  545. 226 Symbol(ReturnSy,'RETURN');
  546. ***** ^ undeclared identifier
  547. ***** ^ undeclared identifier
  548. ***** ^ not supported yet
  549. 227 Symbol(RFlushSy,'RFLUSH');
  550. ***** ^ undeclared identifier
  551. ***** ^ undeclared identifier
  552. ***** ^ not supported yet
  553. 228 Symbol(RGetSy,'RGET');
  554. ***** ^ undeclared identifier
  555. ***** ^ undeclared identifier
  556. ***** ^ not supported yet
  557. 229 Symbol(RunSy,'RUN');
  558. ***** ^ undeclared identifier
  559. ***** ^ undeclared identifier
  560. ***** ^ not supported yet
  561. 230 Symbol(SendFileSy,'SENDFILE');
  562. ***** ^ undeclared identifier
  563. ***** ^ undeclared identifier
  564. ***** ^ not supported yet
  565. 231 Symbol(SetSy,'SET');
  566. ***** ^ undeclared identifier
  567. ***** ^ undeclared identifier
  568. ***** ^ not supported yet
  569. 232 Symbol(SnapshotSy,'SNAPSHOT');
  570. ***** ^ undeclared identifier
  571. ***** ^ undeclared identifier
  572. ***** ^ not supported yet
  573. 233 Symbol(SuccessSy,'SUCCESS');
  574. ***** ^ undeclared identifier
  575. ***** ^ undeclared identifier
  576. ***** ^ not supported yet
  577. 234 Symbol(SuspendSy,'SUSPEND');
  578. ***** ^ undeclared identifier
  579. ***** ^ undeclared identifier
  580. ***** ^ not supported yet
  581. 235 Symbol(SwitchSy,'SWITCH');
  582. ***** ^ undeclared identifier
  583. ***** ^ undeclared identifier
  584. ***** ^ not supported yet
  585. 236 Symbol(TraceSy,'TRACE');
  586. ***** ^ undeclared identifier
  587. ***** ^ undeclared identifier
  588. ***** ^ not supported yet
  589. 237 Symbol(TransmitSy,'TRANSMIT');
  590. ***** ^ undeclared identifier
  591. ***** ^ undeclared identifier
  592. ***** ^ not supported yet
  593. 238 Symbol(WaitSy,'WAIT');
  594. ***** ^ undeclared identifier
  595. ***** ^ undeclared identifier
  596. ***** ^ not supported yet
  597. 239 Symbol(WaitForSy,'WAITFOR');
  598. ***** ^ undeclared identifier
  599. ***** ^ undeclared identifier
  600. ***** ^ not supported yet
  601. 240 Symbol(WhenSy,'WHEN');
  602. ***** ^ undeclared identifier
  603. ***** ^ undeclared identifier
  604. ***** ^ not supported yet
  605. 241 Symbol(FTWXmodem,'WXMODEM');
  606. ***** ^ undeclared identifier
  607. ***** ^ undeclared identifier
  608. ***** ^ not supported yet
  609. 242 Symbol(FTXmodem,'XMODEM');
  610. ***** ^ undeclared identifier
  611. ***** ^ undeclared identifier
  612. ***** ^ not supported yet
  613. 243 Symbol(FTYmodem,'YMODEM');
  614. ***** ^ undeclared identifier
  615. ***** ^ undeclared identifier
  616. ***** ^ not supported yet
  617. 244 END InitSymbolTable;
  618. ***** ^ not supported yet
  619. 245
  620. 246 (*.................................................*)
  621. 247
  622. 248 PROCEDURE InitScanner;
  623. 249 VAR
  624. 250 i : CARDINAL;
  625. 251 BEGIN
  626. 252 FOR i:=0 TO 3 DO
  627. 253 History[i,0] := 0C;
  628. ***** ^ not supported yet
  629. ***** ^ not supported yet
  630. 254 END;
  631. 255 CurrentLine[0] := 0C;
  632. ***** ^ not supported yet
  633. ***** ^ not supported yet
  634. 256 Stdwords := 0;
  635. 257 InitSymbolTable;
  636. ***** ^ not supported yet
  637. 258 LineLength := 0;
  638. 259 LineNumber := 0;
  639. 260 LineIndex := 0FFFFH;
  640. 261 FirstSymOnLine := TRUE;
  641. 262 GotError := FALSE;
  642. ***** ^ undeclared identifier
  643. 263 END InitScanner;
  644. ***** ^ not supported yet
  645. 264
  646. 265 (*................................................*)
  647. 266
  648. 267 PROCEDURE GetChar(VAR Ch:CHAR);
  649. 268 VAR
  650. 269 i : CARDINAL;
  651. 270 BEGIN
  652. 271 IF LineIndex>LineLength THEN
  653. 272 IF FIO.EOF THEN
  654. ***** ^ undeclared identifier
  655. ***** ^ not supported yet
  656. 273 Ch:=0C;
  657. 274 LineIndex:=0FFFFH;
  658. 275 LineLength:=0;
  659. 276 RETURN
  660. 277 END;
  661. 278 FOR i:=0 TO 2 DO
  662. 279 History[i] := History[i+1];
  663. ***** ^ not supported yet
  664. ***** ^ not supported yet
  665. ***** ^ not supported yet
  666. ***** ^ not supported yet
  667. 280 END;
  668. 281 History[3] := CurrentLine;
  669. ***** ^ not supported yet
  670. ***** ^ not supported yet
  671. ***** ^ not supported yet
  672. 282 History[3,LineLength] := 0C;
  673. ***** ^ not supported yet
  674. ***** ^ not supported yet
  675. 283 FIO.RdStr(infile,CurrentLine);
  676. ***** ^ undeclared identifier
  677. ***** ^ not supported yet
  678. ***** ^ undeclared identifier
  679. ***** ^ not supported yet
  680. 284 IF FIO.EOF THEN
  681. ***** ^ undeclared identifier
  682. ***** ^ not supported yet
  683. 285 Ch := 0C;
  684. 286 RETURN;
  685. 287 END; (*IF*)
  686. 288 INC(LineNumber);
  687. ***** ^ undeclared identifier
  688. ***** ^ not supported yet
  689. 289 LineLength := Str.Length(CurrentLine);
  690. ***** ^ not supported yet
  691. ***** ^ not supported yet
  692. ***** ^ not supported yet
  693. 290 CurrentLine[LineLength] := CHR(13);
  694. ***** ^ not supported yet
  695. ***** ^ not supported yet
  696. ***** ^ undeclared identifier
  697. ***** ^ not supported yet
  698. 291 LineIndex := Lib.ScanNeR(ADR(CurrentLine),LineLength,' ');
  699. ***** ^ not supported yet
  700. ***** ^ not supported yet
  701. ***** ^ undeclared identifier
  702. ***** ^ not supported yet
  703. ***** ^ not supported yet
  704. 292 FirstSymOnLine := TRUE;
  705. 293 END;
  706. 294 Ch := CurrentLine[LineIndex];
  707. ***** ^ not supported yet
  708. ***** ^ not supported yet
  709. 295 INC(LineIndex);
  710. ***** ^ undeclared identifier
  711. ***** ^ not supported yet
  712. 296 END GetChar;
  713. ***** ^ not supported yet
  714. 297
  715. 298 (*................................................*)
  716. 299
  717. 300 PROCEDURE PushBack;
  718. 301 BEGIN
  719. 302 IF LineIndex>0 THEN
  720. 303 DEC(LineIndex);
  721. ***** ^ undeclared identifier
  722. ***** ^ not supported yet
  723. 304 END;
  724. 305 END PushBack;
  725. ***** ^ not supported yet
  726. 306
  727. 307 (*................................................*)
  728. 308
  729. 309 PROCEDURE GetSym;
  730. 310 VAR
  731. 311 GotSym : BOOLEAN;
  732. 312
  733. 313 (*. . . . . . . . . . . . . . . . . . . . . . . . .*)
  734. 314
  735. 315 PROCEDURE AddChar(VAR S:ARRAY OF CHAR; Ch:CHAR);
  736. ***** ^ not supported yet
  737. 316 BEGIN
  738. 317 IF Lnth<Max THEN
  739. 318 S[Lnth]:=Ch;
  740. ***** ^ not supported yet
  741. ***** ^ not supported yet
  742. 319 INC(Lnth);
  743. ***** ^ undeclared identifier
  744. ***** ^ not supported yet
  745. 320 S[Lnth]:=0C;
  746. ***** ^ not supported yet
  747. ***** ^ not supported yet
  748. 321 END;
  749. 322 END AddChar;
  750. ***** ^ not supported yet
  751. 323
  752. 324 (*. . . . . . . . . . . . . . . . . . . . . . . . .*)
  753. 325
  754. 326 PROCEDURE CopyString;
  755. 327 VAR
  756. 328 QuoteChar : CHAR;
  757. 329 BEGIN
  758. 330 QuoteChar:=Ch;
  759. 331 Lnth:=0;
  760. 332 Max:=255;
  761. 333 Sy:=StringConst;
  762. ***** ^ undeclared identifier
  763. ***** ^ undeclared identifier
  764. 334 REPEAT
  765. 335 GetChar(Ch);
  766. ***** ^ not supported yet
  767. ***** ^ not supported yet
  768. 336 IF (Ch=0C) OR (Ch=CHR(13)) THEN
  769. ***** ^ undeclared identifier
  770. ***** ^ not supported yet
  771. 337 Error(1);
  772. ***** ^ not supported yet
  773. ***** ^ not supported yet
  774. 338 END;
  775. 339 IF Ch<>QuoteChar THEN
  776. 340 AddChar(LastStringConst,Ch);
  777. ***** ^ not supported yet
  778. ***** ^ undeclared identifier
  779. ***** ^ not supported yet
  780. 341 END;
  781. 342 UNTIL Ch=QuoteChar;
  782. 343 END CopyString;
  783. ***** ^ not supported yet
  784. 344
  785. 345 (*. . . . . . . . . . . . . . . . . . . . . . . . .*)
  786. 346
  787. 347 PROCEDURE Number;
  788. 348 BEGIN
  789. 349 LastNumConst:='';
  790. ***** ^ undeclared identifier
  791. 350 Lnth:=0;
  792. 351 Max:=MaxSymLnth;
  793. ***** ^ undeclared identifier
  794. 352 Sy:=IntConst;
  795. ***** ^ undeclared identifier
  796. ***** ^ undeclared identifier
  797. 353 REPEAT
  798. 354 AddChar(LastNumConst,Ch);
  799. ***** ^ not supported yet
  800. ***** ^ undeclared identifier
  801. ***** ^ not supported yet
  802. 355 GetChar(Ch);
  803. ***** ^ not supported yet
  804. ***** ^ not supported yet
  805. 356 UNTIL (Ch<'0') OR (Ch>'9');
  806. 357 PushBack;
  807. ***** ^ not supported yet
  808. 358 END Number;
  809. ***** ^ not supported yet
  810. 359
  811. 360 (*. . . . . . . . . . . . . . . . . . . . . . . . .*)
  812. 361
  813. 362 PROCEDURE Identifier;
  814. 363
  815. 364 (*. . . . . . . . . . . . . . . . .*)
  816. 365
  817. 366 PROCEDURE CheckResWords;
  818. 367 VAR
  819. 368 Result,K,L,R : INTEGER;
  820. 369 BEGIN
  821. 370 L:=0;
  822. 371 R:=Stdwords-1;
  823. 372 REPEAT
  824. 373 K := (L+R) DIV 2;
  825. 374 Result := StrCompare(Id,Reswords[K].WordId);
  826. ***** ^ not supported yet
  827. ***** ^ undeclared identifier
  828. ***** ^ not supported yet
  829. ***** ^ not supported yet
  830. ***** ^ not supported yet
  831. 375 IF Result<=0 THEN
  832. 376 R:=K-1;
  833. 377 END;
  834. 378 IF Result>=0 THEN
  835. 379 L:=K+1;
  836. 380 END;
  837. 381 UNTIL R<L;
  838. 382 IF L-R>1 THEN
  839. 383 Sy := Reswords[K].RSy;
  840. ***** ^ undeclared identifier
  841. ***** ^ not supported yet
  842. ***** ^ not supported yet
  843. ***** ^ not supported yet
  844. 384 END;
  845. 385 END CheckResWords;
  846. ***** ^ not supported yet
  847. 386
  848. 387 (*. . . . . . . . . . . . . . . . .*)
  849. 388
  850. 389 BEGIN (* Identifier *)
  851. 390 Sy:=Ident;
  852. ***** ^ undeclared identifier
  853. ***** ^ undeclared identifier
  854. 391 Lnth:=0;
  855. 392 Max:=MaxSymLnth;
  856. ***** ^ undeclared identifier
  857. 393 LOOP
  858. 394 CASE Ch OF
  859. 395 '_',
  860. 396 'a'..'z',
  861. 397 '0'..'9',
  862. 398 'A'..'Z' : AddChar(Id,CAP(Ch));
  863. ***** ^ not supported yet
  864. ***** ^ undeclared identifier
  865. ***** ^ undeclared identifier
  866. ***** ^ not supported yet
  867. 399 GetChar(Ch) |
  868. ***** ^ not supported yet
  869. ***** ^ not supported yet
  870. 400 ELSE
  871. 401 EXIT;
  872. 402 END;
  873. 403 END;
  874. 404 PushBack;
  875. ***** ^ not supported yet
  876. 405 CheckResWords;
  877. ***** ^ not supported yet
  878. 406 END Identifier;
  879. ***** ^ not supported yet
  880. 407
  881. 408 (*. . . . . . . . . . . . . . . . . . . . . . . . .*)
  882. 409
  883. 410 PROCEDURE Comment;
  884. 411 BEGIN
  885. 412 (* Throw away remainder of line *)
  886. 413 LineIndex := LineLength+1;
  887. 414 END Comment;
  888. ***** ^ not supported yet
  889. 415
  890. 416 (*. . . . . . . . . . . . . . . . . . . . . . . . .*)
  891. 417
  892. 418 BEGIN (* GetSym *)
  893. 419 REPEAT
  894. 420 Sy:=Other;
  895. ***** ^ undeclared identifier
  896. ***** ^ undeclared identifier
  897. 421 GotSym:=TRUE;
  898. 422 REPEAT
  899. 423 GetChar(Ch);
  900. ***** ^ not supported yet
  901. ***** ^ not supported yet
  902. 424 UNTIL (Ch=0C) OR ((Ch>' ') AND (Ch<=CHR(126)));
  903. ***** ^ undeclared identifier
  904. ***** ^ not supported yet
  905. 425 TokenPos := LineIndex-1;
  906. 426 CASE Ch OF
  907. 427 0C : Sy:=EndOfFile; |
  908. ***** ^ undeclared identifier
  909. ***** ^ undeclared identifier
  910. 428 '"' : CopyString; |
  911. ***** ^ not supported yet
  912. 429 '0'..'9' : Number; |
  913. ***** ^ not supported yet
  914. 430 'A'..'Z',
  915. 431 'a'..'z' : Identifier; |
  916. ***** ^ not supported yet
  917. 432 ';' : Comment;
  918. ***** ^ not supported yet
  919. 433 GotSym := FALSE; |
  920. 434 ',' : Sy := Comma;
  921. ***** ^ undeclared identifier
  922. ***** ^ undeclared identifier
  923. 435 GotSym := FALSE; |
  924. 436 ':' : Sy := Colon; |
  925. ***** ^ undeclared identifier
  926. ***** ^ undeclared identifier
  927. 437 ELSE
  928. 438 Error(2)
  929. ***** ^ not supported yet
  930. ***** ^ not supported yet
  931. 439 END; (* cases *)
  932. 440 FirstSymOnLine := FALSE;
  933. 441 UNTIL GotSym;
  934. 442 END GetSym;
  935. ***** ^ not supported yet
  936. 443
  937. 444 (*................................................*)
  938. 445
  939. 446 END Scanner.
  940. ***** ^ not supported yet
  941. 447
  942. 493 errors