scanner.pas 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642
  1. {
  2. $Id$
  3. Copyright (c) 1993,97 by Florian Klaempfl
  4. This unit implements the scanner part and handling of the switches
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. {$ifdef tp}
  19. {$F+,N+,E+,R-}
  20. {$endif}
  21. unit scanner;
  22. interface
  23. uses
  24. cobjects,globals,verbose,comphook,files;
  25. const
  26. {$ifdef TP}
  27. maxmacrolen=1024;
  28. {$else}
  29. maxmacrolen=16*1024;
  30. {$endif}
  31. id_len = 14;
  32. Newline = #10;
  33. type
  34. ident = string[id_len];
  35. const
  36. max_keywords = 70;
  37. anz_keywords : longint = max_keywords;
  38. { the following keywords are no keywords in TP, they
  39. are internal procedures
  40. CONTINUE, DISPOSE, EXIT, FAIL, FALSE, NEW, SELF
  41. TRUE
  42. }
  43. { INLINE is a keyword in TP, but only an modifier in FPC }
  44. keyword : array[1..max_keywords] of ident = (
  45. { 'ABSOLUTE',}
  46. 'AND',
  47. 'ARRAY','AS','ASM',
  48. { 'ASSEMBLER',}
  49. 'BEGIN',
  50. 'CASE','CLASS',
  51. 'CONST','CONSTRUCTOR',
  52. 'DESTRUCTOR','DISPOSE','DIV','DO','DOWNTO','ELSE','END',
  53. 'EXCEPT',
  54. 'EXIT',
  55. { 'EXPORT',}
  56. 'EXPORTS',
  57. { 'EXTERNAL',}
  58. 'FAIL','FALSE',
  59. { 'FAR',}
  60. 'FILE','FINALIZATION','FINALLY','FOR',
  61. { 'FORWARD',}
  62. 'FUNCTION','GOTO','IF','IMPLEMENTATION','IN',
  63. 'INHERITED','INITIALIZATION',
  64. { 'INLINE',} {INLINE is a reserved word in TP. Why?}
  65. 'INTERFACE',
  66. { 'INTERRUPT',}
  67. 'IS',
  68. 'LABEL','LIBRARY','MOD',
  69. { 'NEAR',}
  70. 'NEW','NIL','NOT','OBJECT',
  71. 'OF','ON','OPERATOR','OR','OTHERWISE','PACKED',
  72. 'PROCEDURE','PROGRAM','PROPERTY',
  73. 'RAISE','RECORD','REPEAT','SELF',
  74. 'SET','SHL','SHR','STRING','THEN','TO',
  75. 'TRUE','TRY','TYPE','UNIT','UNTIL',
  76. 'USES','VAR',
  77. { 'VIRTUAL',}
  78. 'WHILE','WITH','XOR');
  79. keyword_token : array[1..max_keywords] of ttoken = (
  80. { _ABSOLUTE,}
  81. _AND,
  82. _ARRAY,_AS,_ASM,
  83. { _ASSEMBLER,}
  84. _BEGIN,
  85. _CASE,_CLASS,
  86. _CONST,_CONSTRUCTOR,
  87. _DESTRUCTOR,_DISPOSE,_DIV,_DO,_DOWNTO,
  88. _ELSE,_END,_EXCEPT,
  89. _EXIT,
  90. { _EXPORT,}
  91. _EXPORTS,
  92. { _EXTERNAL,}
  93. _FAIL,_FALSE,
  94. { _FAR,}
  95. _FILE,_FINALIZATION,_FINALLY,_FOR,
  96. { _FORWARD,}
  97. _FUNCTION,_GOTO,_IF,_IMPLEMENTATION,_IN,
  98. _INHERITED,_INITIALIZATION,
  99. { _INLINE,}
  100. _INTERFACE,
  101. { _INTERRUPT,}
  102. _IS,
  103. _LABEL,_LIBRARY,_MOD,
  104. { _NEAR,}
  105. _NEW,_NIL,_NOT,_OBJECT,
  106. _OF,_ON,_OPERATOR,_OR,_OTHERWISE,_PACKED,
  107. _PROCEDURE,_PROGRAM,_PROPERTY,
  108. _RAISE,_RECORD,_REPEAT,_SELF,
  109. _SET,_SHL,_SHR,_STRING,_THEN,_TO,
  110. _TRUE,_TRY,_TYPE,_UNIT,_UNTIL,
  111. _USES,_VAR,
  112. { _VIRTUAL,}
  113. _WHILE,_WITH,_XOR);
  114. type
  115. pmacrobuffer = ^tmacrobuffer;
  116. tmacrobuffer = array[0..maxmacrolen-1] of char;
  117. ppreprocstack = ^tpreprocstack;
  118. tpreprocstack = object
  119. accept : boolean;
  120. next : ppreprocstack;
  121. name : stringid;
  122. line_nb : longint;
  123. constructor init(a:boolean;n:ppreprocstack);
  124. destructor done;
  125. end;
  126. pscannerfile = ^tscannerfile;
  127. tscannerfile = object
  128. inputfile : pinputfile; { current inputfile list }
  129. inputbuffer, { input buffer }
  130. inputpointer : pchar;
  131. inputstart : longint;
  132. line_no, { line }
  133. lastlinepos : longint;
  134. lasttokenpos : longint; { token }
  135. lasttoken : ttoken;
  136. do_special, { 1=point after nr, 2=caret after id }
  137. comment_level,
  138. yylexcount : longint;
  139. lastasmgetchar : char;
  140. preprocstack : ppreprocstack;
  141. constructor init(const fn:string);
  142. destructor done;
  143. { File buffer things }
  144. function openinputfile:boolean;
  145. procedure closeinputfile;
  146. function tempopeninputfile:boolean;
  147. procedure tempcloseinputfile;
  148. procedure saveinputfile;
  149. procedure restoreinputfile;
  150. procedure nextfile;
  151. procedure addfile(hp:pinputfile);
  152. procedure reload;
  153. procedure insertmacro(p:pchar;len:longint);
  154. { Scanner things }
  155. procedure gettokenpos;
  156. procedure inc_comment_level;
  157. procedure dec_comment_level;
  158. procedure checkpreprocstack;
  159. procedure poppreprocstack;
  160. procedure addpreprocstack(a:boolean;const s:string;w:tmsgconst);
  161. procedure elsepreprocstack;
  162. procedure linebreak;
  163. procedure readchar;
  164. procedure readstring;
  165. procedure readnumber;
  166. function readid:string;
  167. function readval:longint;
  168. function readcomment:string;
  169. procedure skipspace;
  170. procedure skipuntildirective;
  171. procedure skipcomment;
  172. procedure skipdelphicomment;
  173. procedure skipoldtpcomment;
  174. function yylex:ttoken;
  175. function readpreproc:ttoken;
  176. function asmgetchar:char;
  177. end;
  178. var
  179. c : char;
  180. orgpattern,
  181. pattern : string;
  182. current_scanner : pscannerfile;
  183. { changes to keywords to be tp compatible }
  184. procedure change_to_tp_keywords;
  185. implementation
  186. uses
  187. dos,systems,symtable,switches;
  188. {*****************************************************************************
  189. Helper routines
  190. *****************************************************************************}
  191. function is_keyword(var token : ttoken) : boolean;
  192. var
  193. high,low,mid : longint;
  194. begin
  195. low:=1;
  196. high:=anz_keywords;
  197. while low<high do
  198. begin
  199. mid:=(high+low+1) shr 1;
  200. if pattern<keyword[mid] then
  201. high:=mid-1
  202. else
  203. low:=mid;
  204. end;
  205. if pattern=keyword[high] then
  206. begin
  207. token:=keyword_token[high];
  208. is_keyword:=true;
  209. end
  210. else
  211. is_keyword:=false;
  212. end;
  213. procedure remove_keyword(const s : string);
  214. var
  215. i,j : longint;
  216. begin
  217. for i:=1 to anz_keywords do
  218. begin
  219. if keyword[i]=s then
  220. begin
  221. for j:=i to anz_keywords-1 do
  222. begin
  223. keyword[j]:=keyword[j+1];
  224. keyword_token[j]:=keyword_token[j+1];
  225. end;
  226. dec(anz_keywords);
  227. break;
  228. end;
  229. end;
  230. end;
  231. procedure change_to_tp_keywords;
  232. const
  233. non_tp : array[0..14] of string[id_len] = (
  234. 'AS','CLASS','EXCEPT','FINALLY','INITIALIZATION','IS',
  235. 'ON','OPERATOR','OTHERWISE','PROPERTY','RAISE','TRY',
  236. 'EXPORTS','LIBRARY','FINALIZATION');
  237. var
  238. i : longint;
  239. begin
  240. for i:=0 to 13 do
  241. remove_keyword(non_tp[i]);
  242. end;
  243. {*****************************************************************************
  244. TPreProcStack
  245. *****************************************************************************}
  246. constructor tpreprocstack.init(a:boolean;n:ppreprocstack);
  247. begin
  248. accept:=a;
  249. next:=n;
  250. end;
  251. destructor tpreprocstack.done;
  252. begin
  253. end;
  254. {****************************************************************************
  255. TSCANNERFILE
  256. ****************************************************************************}
  257. constructor tscannerfile.init(const fn:string);
  258. begin
  259. inputfile:=new(pinputfile,init(fn));
  260. current_module^.sourcefiles.register_file(inputfile);
  261. { reset localinput }
  262. inputbuffer:=nil;
  263. inputpointer:=nil;
  264. inputstart:=0;
  265. { reset scanner }
  266. preprocstack:=nil;
  267. comment_level:=0;
  268. do_special:=0;
  269. yylexcount:=0;
  270. block_type:=bt_general;
  271. line_no:=0;
  272. lastlinepos:=0;
  273. lasttokenpos:=0;
  274. lasttoken:=_END;
  275. lastasmgetchar:=#0;
  276. { load block }
  277. if not openinputfile then
  278. Message1(scan_f_cannot_open_input,fn);
  279. reload;
  280. end;
  281. destructor tscannerfile.done;
  282. begin
  283. checkpreprocstack;
  284. { close file }
  285. if not inputfile^.closed then
  286. closeinputfile;
  287. end;
  288. function tscannerfile.openinputfile:boolean;
  289. begin
  290. openinputfile:=inputfile^.open;
  291. { load buffer }
  292. inputbuffer:=inputfile^.buf;
  293. inputpointer:=inputfile^.buf;
  294. inputstart:=inputfile^.bufstart;
  295. { line }
  296. line_no:=0;
  297. lastlinepos:=0;
  298. lasttokenpos:=0;
  299. end;
  300. procedure tscannerfile.closeinputfile;
  301. begin
  302. inputfile^.close;
  303. { reset buffer }
  304. inputbuffer:=nil;
  305. inputpointer:=nil;
  306. inputstart:=0;
  307. { reset line }
  308. line_no:=0;
  309. lastlinepos:=0;
  310. lasttokenpos:=0;
  311. end;
  312. function tscannerfile.tempopeninputfile:boolean;
  313. begin
  314. tempopeninputfile:=inputfile^.tempopen;
  315. { reload buffer }
  316. inputbuffer:=inputfile^.buf;
  317. inputpointer:=inputfile^.buf;
  318. inputstart:=inputfile^.bufstart;
  319. end;
  320. procedure tscannerfile.tempcloseinputfile;
  321. begin
  322. inputfile^.setpos(inputstart+(inputpointer-inputbuffer));
  323. inputfile^.tempclose;
  324. { reset buffer }
  325. inputbuffer:=nil;
  326. inputpointer:=nil;
  327. inputstart:=0;
  328. end;
  329. procedure tscannerfile.saveinputfile;
  330. begin
  331. inputfile^.saveinputpointer:=inputpointer;
  332. inputfile^.savelastlinepos:=lastlinepos;
  333. inputfile^.saveline_no:=line_no;
  334. end;
  335. procedure tscannerfile.restoreinputfile;
  336. begin
  337. inputpointer:=inputfile^.saveinputpointer;
  338. lastlinepos:=inputfile^.savelastlinepos;
  339. line_no:=inputfile^.saveline_no;
  340. end;
  341. procedure tscannerfile.nextfile;
  342. begin
  343. if assigned(inputfile^.next) then
  344. begin
  345. inputfile:=inputfile^.next;
  346. restoreinputfile;
  347. end;
  348. end;
  349. procedure tscannerfile.addfile(hp:pinputfile);
  350. begin
  351. saveinputfile;
  352. { add to list }
  353. hp^.next:=inputfile;
  354. inputfile:=hp;
  355. { load new inputfile }
  356. restoreinputfile;
  357. end;
  358. procedure tscannerfile.reload;
  359. begin
  360. with inputfile^ do
  361. begin
  362. repeat
  363. { still more to read?, then change the #0 to a space so its seen
  364. as a seperator }
  365. if (bufsize>0) and (inputpointer-inputbuffer<bufsize) then
  366. begin
  367. c:=' ';
  368. inc(longint(inputpointer));
  369. exit;
  370. end;
  371. { can we read more from this file ? }
  372. if not endoffile then
  373. begin
  374. readbuf;
  375. inputpointer:=buf;
  376. inputbuffer:=buf;
  377. inputstart:=bufstart;
  378. { first line? }
  379. if line_no=0 then
  380. begin
  381. line_no:=1;
  382. if cs_asm_source in aktglobalswitches then
  383. inputfile^.setline(line_no,bufstart);
  384. end;
  385. end
  386. else
  387. begin
  388. closeinputfile;
  389. { no next module, than EOF }
  390. if not assigned(inputfile^.next) then
  391. begin
  392. c:=#26;
  393. exit;
  394. end;
  395. { load next file and reopen it }
  396. nextfile;
  397. tempopeninputfile;
  398. { status }
  399. Message1(scan_d_back_in,name^);
  400. end;
  401. { load next char }
  402. c:=inputpointer^;
  403. inc(longint(inputpointer));
  404. until c<>#0; { if also end, then reload again }
  405. end;
  406. end;
  407. procedure tscannerfile.insertmacro(p:pchar;len:longint);
  408. var
  409. hp : pinputfile;
  410. begin
  411. { save old postion }
  412. dec(longint(inputpointer));
  413. tempcloseinputfile;
  414. { create macro 'file' }
  415. hp:=new(pinputfile,init('Macro'));
  416. addfile(hp);
  417. with inputfile^ do
  418. begin
  419. setmacro(p,len);
  420. { local buffer }
  421. inputbuffer:=buf;
  422. inputpointer:=buf;
  423. inputstart:=bufstart;
  424. end;
  425. { reset line }
  426. line_no:=0;
  427. lastlinepos:=0;
  428. lasttokenpos:=0;
  429. { load new c }
  430. c:=inputpointer^;
  431. inc(longint(inputpointer));
  432. end;
  433. procedure tscannerfile.gettokenpos;
  434. { load the values of tokenpos and lasttokenpos }
  435. begin
  436. lasttokenpos:=inputstart+(inputpointer-inputbuffer);
  437. tokenpos.line:=line_no;
  438. tokenpos.column:=lasttokenpos-lastlinepos;
  439. tokenpos.fileindex:=inputfile^.ref_index;
  440. aktfilepos:=tokenpos;
  441. end;
  442. procedure tscannerfile.inc_comment_level;
  443. var
  444. oldaktfilepos : tfileposinfo;
  445. begin
  446. inc(comment_level);
  447. if (comment_level>1) then
  448. begin
  449. oldaktfilepos:=aktfilepos;
  450. gettokenpos; { update for warning }
  451. Message1(scan_w_comment_level,tostr(comment_level));
  452. aktfilepos:=oldaktfilepos;
  453. end;
  454. end;
  455. procedure tscannerfile.dec_comment_level;
  456. begin
  457. if (cs_tp_compatible in aktmoduleswitches) or
  458. (cs_delphi2_compatible in aktmoduleswitches) then
  459. comment_level:=0
  460. else
  461. dec(comment_level);
  462. end;
  463. procedure tscannerfile.linebreak;
  464. var
  465. cur : char;
  466. oldtokenpos,
  467. oldaktfilepos : tfileposinfo;
  468. begin
  469. with inputfile^ do
  470. begin
  471. if (byte(inputpointer^)=0) and not(endoffile) then
  472. begin
  473. cur:=c;
  474. reload;
  475. if byte(cur)+byte(c)<>23 then
  476. dec(longint(inputpointer));
  477. end
  478. else
  479. begin
  480. { Fix linebreak to be only newline (=#10) for all types of linebreaks }
  481. if (byte(inputpointer^)+byte(c)=23) then
  482. inc(longint(inputpointer));
  483. end;
  484. c:=newline;
  485. { increase line counters }
  486. lastlinepos:=bufstart+(inputpointer-inputbuffer);
  487. inc(line_no);
  488. { update linebuffer }
  489. if cs_asm_source in aktglobalswitches then
  490. inputfile^.setline(line_no,lastlinepos);
  491. { update for status and call the show status routine,
  492. but don't touch aktfilepos ! }
  493. oldaktfilepos:=aktfilepos;
  494. oldtokenpos:=tokenpos;
  495. gettokenpos; { update for v_status }
  496. inc(status.compiledlines);
  497. ShowStatus;
  498. aktfilepos:=oldaktfilepos;
  499. tokenpos:=oldtokenpos;
  500. end;
  501. end;
  502. procedure tscannerfile.checkpreprocstack;
  503. begin
  504. { check for missing ifdefs }
  505. while assigned(preprocstack) do
  506. begin
  507. Message3(scan_e_endif_expected,'$IF(N)(DEF)',preprocstack^.name,tostr(preprocstack^.line_nb));
  508. poppreprocstack;
  509. end;
  510. end;
  511. procedure tscannerfile.poppreprocstack;
  512. var
  513. hp : ppreprocstack;
  514. begin
  515. if assigned(preprocstack) then
  516. begin
  517. hp:=preprocstack^.next;
  518. dispose(preprocstack,done);
  519. preprocstack:=hp;
  520. end
  521. else
  522. Message(scan_e_endif_without_if);
  523. end;
  524. procedure tscannerfile.addpreprocstack(a:boolean;const s:string;w:tmsgconst);
  525. begin
  526. preprocstack:=new(ppreprocstack,init(((preprocstack=nil) or preprocstack^.accept) and a,preprocstack));
  527. preprocstack^.name:=s;
  528. preprocstack^.line_nb:=line_no;
  529. if preprocstack^.accept then
  530. Message2(w,preprocstack^.name,'accepted')
  531. else
  532. Message2(w,preprocstack^.name,'rejected');
  533. end;
  534. procedure tscannerfile.elsepreprocstack;
  535. begin
  536. if assigned(preprocstack) then
  537. begin
  538. if not(assigned(preprocstack^.next)) or (preprocstack^.next^.accept) then
  539. preprocstack^.accept:=not preprocstack^.accept;
  540. if preprocstack^.accept then
  541. Message2(scan_c_else_found,preprocstack^.name,'accepted')
  542. else
  543. Message2(scan_c_else_found,preprocstack^.name,'rejected');
  544. end
  545. else
  546. Message(scan_e_endif_without_if);
  547. end;
  548. procedure tscannerfile.readchar;
  549. begin
  550. c:=inputpointer^;
  551. if c=#0 then
  552. reload
  553. else
  554. inc(longint(inputpointer));
  555. if c in [#10,#13] then
  556. linebreak;
  557. end;
  558. procedure tscannerfile.readstring;
  559. var
  560. i : longint;
  561. begin
  562. i:=0;
  563. repeat
  564. case c of
  565. '_',
  566. '0'..'9',
  567. 'A'..'Z' : begin
  568. if i<255 then
  569. begin
  570. inc(i);
  571. orgpattern[i]:=c;
  572. pattern[i]:=c;
  573. end;
  574. c:=inputpointer^;
  575. inc(longint(inputpointer));
  576. end;
  577. 'a'..'z' : begin
  578. if i<255 then
  579. begin
  580. inc(i);
  581. orgpattern[i]:=c;
  582. pattern[i]:=chr(ord(c)-32)
  583. end;
  584. c:=inputpointer^;
  585. inc(longint(inputpointer));
  586. end;
  587. #0 : reload;
  588. #13,#10 : begin
  589. linebreak;
  590. break;
  591. end;
  592. else
  593. break;
  594. end;
  595. until false;
  596. orgpattern[0]:=chr(i);
  597. pattern[0]:=chr(i);
  598. end;
  599. procedure tscannerfile.readnumber;
  600. var
  601. base,
  602. i : longint;
  603. begin
  604. case c of
  605. '%' : begin
  606. readchar;
  607. base:=2;
  608. pattern[1]:='%';
  609. i:=1;
  610. end;
  611. '$' : begin
  612. readchar;
  613. base:=16;
  614. pattern[1]:='$';
  615. i:=1;
  616. end;
  617. else
  618. begin
  619. base:=10;
  620. i:=0;
  621. end;
  622. end;
  623. while ((base>=10) and (c in ['0'..'9'])) or
  624. ((base=16) and (c in ['A'..'F','a'..'f'])) or
  625. ((base=2) and (c in ['0'..'1'])) do
  626. begin
  627. if i<255 then
  628. begin
  629. inc(i);
  630. pattern[i]:=c;
  631. end;
  632. { get next char }
  633. c:=inputpointer^;
  634. if c=#0 then
  635. reload
  636. else
  637. inc(longint(inputpointer));
  638. end;
  639. { was the next char a linebreak ? }
  640. if c in [#10,#13] then
  641. linebreak;
  642. pattern[0]:=chr(i);
  643. end;
  644. function tscannerfile.readid:string;
  645. begin
  646. readstring;
  647. readid:=pattern;
  648. end;
  649. function tscannerfile.readval:longint;
  650. var
  651. l : longint;
  652. w : word;
  653. begin
  654. readnumber;
  655. valint(pattern,l,w);
  656. readval:=l;
  657. end;
  658. function tscannerfile.readcomment:string;
  659. var
  660. i : longint;
  661. begin
  662. i:=0;
  663. repeat
  664. case c of
  665. '}' : begin
  666. readchar;
  667. dec_comment_level;
  668. break;
  669. end;
  670. #26 : Message(scan_f_end_of_file);
  671. else
  672. begin
  673. if (i<255) then
  674. begin
  675. inc(i);
  676. readcomment[i]:=c;
  677. end;
  678. end;
  679. end;
  680. c:=inputpointer^;
  681. if c=#0 then
  682. reload
  683. else
  684. inc(longint(inputpointer));
  685. if c in [#10,#13] then
  686. linebreak;
  687. until false;
  688. readcomment[0]:=chr(i);
  689. end;
  690. procedure tscannerfile.skipspace;
  691. begin
  692. while c in [' ',#9..#13] do
  693. begin
  694. c:=inputpointer^;
  695. if c=#0 then
  696. reload
  697. else
  698. inc(longint(inputpointer));
  699. if c in [#10,#13] then
  700. linebreak;
  701. end;
  702. end;
  703. procedure tscannerfile.skipuntildirective;
  704. var
  705. found : longint;
  706. begin
  707. found:=0;
  708. repeat
  709. case c of
  710. #26 : Message(scan_f_end_of_file);
  711. '{' : begin
  712. if comment_level=0 then
  713. found:=1;
  714. inc_comment_level;
  715. end;
  716. '}' : begin
  717. dec_comment_level;
  718. found:=0;
  719. end;
  720. '$' : begin
  721. if found=1 then
  722. found:=2;
  723. end;
  724. else
  725. found:=0;
  726. end;
  727. c:=inputpointer^;
  728. if c=#0 then
  729. reload
  730. else
  731. inc(longint(inputpointer));
  732. if c in [#10,#13] then
  733. linebreak;
  734. until (found=2);
  735. end;
  736. {$i scandir.inc}
  737. procedure tscannerfile.skipcomment;
  738. begin
  739. readchar;
  740. inc_comment_level;
  741. { handle compiler switches }
  742. if (c='$') then
  743. handledirectives;
  744. { handle_switches can dec comment_level, }
  745. while (comment_level>0) do
  746. begin
  747. case c of
  748. '{' : inc_comment_level;
  749. '}' : dec_comment_level;
  750. #26 : Message(scan_f_end_of_file);
  751. end;
  752. c:=inputpointer^;
  753. if c=#0 then
  754. reload
  755. else
  756. inc(longint(inputpointer));
  757. if c in [#10,#13] then
  758. linebreak;
  759. end;
  760. end;
  761. procedure tscannerfile.skipdelphicomment;
  762. begin
  763. inc_comment_level;
  764. readchar;
  765. { this is currently not supported }
  766. if c='$' then
  767. Message(scan_e_wrong_styled_switch);
  768. { skip comment }
  769. while c<>newline do
  770. begin
  771. if c=#26 then
  772. Message(scan_f_end_of_file);
  773. readchar;
  774. end;
  775. dec_comment_level;
  776. end;
  777. procedure tscannerfile.skipoldtpcomment;
  778. var
  779. found : longint;
  780. begin
  781. inc_comment_level;
  782. readchar;
  783. { this is currently not supported }
  784. if c='$' then
  785. Message(scan_e_wrong_styled_switch);
  786. { skip comment }
  787. while (comment_level>0) do
  788. begin
  789. found:=0;
  790. repeat
  791. case c of
  792. #26 : Message(scan_f_end_of_file);
  793. '*' : begin
  794. if found=3 then
  795. inc_comment_level
  796. else
  797. found:=1;
  798. end;
  799. ')' : begin
  800. if found=1 then
  801. begin
  802. dec_comment_level;
  803. if comment_level=0 then
  804. found:=2;
  805. end;
  806. end;
  807. '(' : found:=3;
  808. else
  809. found:=0;
  810. end;
  811. c:=inputpointer^;
  812. if c=#0 then
  813. reload
  814. else
  815. inc(longint(inputpointer));
  816. if c in [#10,#13] then
  817. linebreak;
  818. until (found=2);
  819. end;
  820. end;
  821. function tscannerfile.yylex : ttoken;
  822. var
  823. y : ttoken;
  824. code : word;
  825. l : longint;
  826. mac : pmacrosym;
  827. asciinr : string[3];
  828. label
  829. exit_label;
  830. begin
  831. { was the last character a point ? }
  832. { this code is needed because the scanner if there is a 1. found if }
  833. { this is a floating point number or range like 1..3 }
  834. if do_special>0 then
  835. begin
  836. gettokenpos;
  837. l:=do_special;
  838. do_special:=0;
  839. case l of
  840. 1 : begin
  841. if c='.' then
  842. begin
  843. readchar;
  844. yylex:=POINTPOINT;
  845. goto exit_label;
  846. end;
  847. yylex:=POINT;
  848. goto exit_label;
  849. end;
  850. 2 : begin
  851. yylex:=CARET;
  852. readchar;
  853. goto exit_label;
  854. end;
  855. end;
  856. end;
  857. { Skip all spaces and comments }
  858. repeat
  859. case c of
  860. '{' : skipcomment;
  861. ' ',#9..#13 : skipspace;
  862. else
  863. break;
  864. end;
  865. until false;
  866. { Save current token position }
  867. gettokenpos;
  868. { Check first for a identifier/keyword, this is 20+% faster (PFV) }
  869. if c in ['_','A'..'Z','a'..'z'] then
  870. begin
  871. readstring;
  872. if (length(pattern) in [2..id_len]) and is_keyword(y) then
  873. yylex:=y
  874. else
  875. begin
  876. { this takes some time ... }
  877. if (cs_support_macro in aktmoduleswitches) then
  878. begin
  879. mac:=pmacrosym(macros^.search(pattern));
  880. if assigned(mac) and (assigned(mac^.buftext)) then
  881. begin
  882. insertmacro(mac^.buftext,mac^.buflen);
  883. { handle empty macros }
  884. if c=#0 then
  885. reload;
  886. { play it again ... }
  887. inc(yylexcount);
  888. if yylexcount>16 then
  889. Message(scan_w_macro_deep_ten);
  890. {$ifdef TP}
  891. yylex:=yylex;
  892. {$else}
  893. yylex:=yylex();
  894. {$endif}
  895. { that's all folks }
  896. dec(yylexcount);
  897. exit;
  898. end;
  899. end;
  900. yylex:=ID;
  901. end;
  902. if (c='^') then
  903. do_special:=2;
  904. goto exit_label;
  905. end
  906. else
  907. begin
  908. case c of
  909. '$' : begin
  910. readnumber;
  911. yylex:=INTCONST;
  912. goto exit_label;
  913. end;
  914. '%' : begin
  915. readnumber;
  916. yylex:=INTCONST;
  917. goto exit_label;
  918. end;
  919. '0'..'9' : begin
  920. readnumber;
  921. if (c in ['.','e','E']) then
  922. begin
  923. { first check for a . }
  924. if c='.' then
  925. begin
  926. readchar;
  927. if not(c in ['0'..'9']) then
  928. begin
  929. do_special:=1;
  930. yylex:=INTCONST;
  931. goto exit_label;
  932. end;
  933. pattern:=pattern+'.';
  934. while c in ['0'..'9'] do
  935. begin
  936. pattern:=pattern+c;
  937. readchar;
  938. end;
  939. end;
  940. { E can also follow after a point is scanned }
  941. if c in ['e','E'] then
  942. begin
  943. pattern:=pattern+'E';
  944. readchar;
  945. if c in ['-','+'] then
  946. begin
  947. pattern:=pattern+c;
  948. readchar;
  949. end;
  950. if not(c in ['0'..'9']) then
  951. Message(scan_f_illegal_char);
  952. while c in ['0'..'9'] do
  953. begin
  954. pattern:=pattern+c;
  955. readchar;
  956. end;
  957. end;
  958. yylex:=REALNUMBER;
  959. goto exit_label;
  960. end;
  961. yylex:=INTCONST;
  962. goto exit_label;
  963. end;
  964. ';' : begin
  965. readchar;
  966. yylex:=SEMICOLON;
  967. goto exit_label;
  968. end;
  969. '[' : begin
  970. readchar;
  971. yylex:=LECKKLAMMER;
  972. goto exit_label;
  973. end;
  974. ']' : begin
  975. readchar;
  976. yylex:=RECKKLAMMER;
  977. goto exit_label;
  978. end;
  979. '(' : begin
  980. readchar;
  981. if c='*' then
  982. begin
  983. skipoldtpcomment;
  984. {$ifndef TP}
  985. yylex:=yylex();
  986. {$else}
  987. yylex:=yylex;
  988. {$endif}
  989. exit;
  990. end;
  991. yylex:=LKLAMMER;
  992. goto exit_label;
  993. end;
  994. ')' : begin
  995. readchar;
  996. yylex:=RKLAMMER;
  997. goto exit_label;
  998. end;
  999. '+' : begin
  1000. readchar;
  1001. if (c='=') and (cs_support_c_operators in aktmoduleswitches) then
  1002. begin
  1003. readchar;
  1004. yylex:=_PLUSASN;
  1005. goto exit_label;
  1006. end;
  1007. yylex:=PLUS;
  1008. goto exit_label;
  1009. end;
  1010. '-' : begin
  1011. readchar;
  1012. if (c='=') and (cs_support_c_operators in aktmoduleswitches) then
  1013. begin
  1014. readchar;
  1015. yylex:=_MINUSASN;
  1016. goto exit_label;
  1017. end;
  1018. yylex:=MINUS;
  1019. goto exit_label;
  1020. end;
  1021. ':' : begin
  1022. readchar;
  1023. if c='=' then
  1024. begin
  1025. readchar;
  1026. yylex:=ASSIGNMENT;
  1027. goto exit_label;
  1028. end;
  1029. yylex:=COLON;
  1030. goto exit_label;
  1031. end;
  1032. '*' : begin
  1033. readchar;
  1034. if (c='=') and (cs_support_c_operators in aktmoduleswitches) then
  1035. begin
  1036. readchar;
  1037. yylex:=_STARASN;
  1038. end
  1039. else
  1040. if c='*' then
  1041. begin
  1042. readchar;
  1043. yylex:=STARSTAR;
  1044. end
  1045. else
  1046. yylex:=STAR;
  1047. goto exit_label;
  1048. end;
  1049. '/' : begin
  1050. readchar;
  1051. case c of
  1052. '=' : begin
  1053. if (cs_support_c_operators in aktmoduleswitches) then
  1054. begin
  1055. readchar;
  1056. yylex:=_SLASHASN;
  1057. goto exit_label;
  1058. end;
  1059. end;
  1060. '/' : begin
  1061. skipdelphicomment;
  1062. {$ifndef TP}
  1063. yylex:=yylex();
  1064. {$else TP}
  1065. yylex:=yylex;
  1066. {$endif TP}
  1067. exit;
  1068. end;
  1069. end;
  1070. yylex:=SLASH;
  1071. goto exit_label;
  1072. end;
  1073. '=' : begin
  1074. readchar;
  1075. yylex:=EQUAL;
  1076. goto exit_label;
  1077. end;
  1078. '.' : begin
  1079. readchar;
  1080. if c='.' then
  1081. begin
  1082. readchar;
  1083. yylex:=POINTPOINT;
  1084. goto exit_label;
  1085. end
  1086. else
  1087. yylex:=POINT;
  1088. goto exit_label;
  1089. end;
  1090. '@' : begin
  1091. readchar;
  1092. if c='@' then
  1093. begin
  1094. readchar;
  1095. yylex:=DOUBLEADDR;
  1096. end
  1097. else
  1098. yylex:=KLAMMERAFFE;
  1099. goto exit_label;
  1100. end;
  1101. ',' : begin
  1102. readchar;
  1103. yylex:=COMMA;
  1104. goto exit_label;
  1105. end;
  1106. '''','#','^' : begin
  1107. if c='^' then
  1108. begin
  1109. readchar;
  1110. c:=upcase(c);
  1111. if not(block_type=bt_type) and (c in ['A'..'Z']) then
  1112. begin
  1113. pattern:=chr(ord(c)-64);
  1114. readchar;
  1115. end
  1116. else
  1117. begin
  1118. yylex:=CARET;
  1119. goto exit_label;
  1120. end;
  1121. end
  1122. else
  1123. pattern:='';
  1124. repeat
  1125. case c of
  1126. '#' : begin
  1127. readchar; { read # }
  1128. if c='$' then
  1129. begin
  1130. readchar; { read leading $ }
  1131. asciinr:='$';
  1132. while (upcase(c) in ['A'..'F','0'..'9']) and (length(asciinr)<3) do
  1133. begin
  1134. asciinr:=asciinr+c;
  1135. readchar;
  1136. end;
  1137. end
  1138. else
  1139. begin
  1140. asciinr:='';
  1141. while (c in ['0'..'9']) and (length(asciinr)<3) do
  1142. begin
  1143. asciinr:=asciinr+c;
  1144. readchar;
  1145. end;
  1146. end;
  1147. valint(asciinr,l,code);
  1148. if (asciinr='') or (code<>0) or
  1149. (l<0) or (l>255) then
  1150. Message(scan_e_illegal_char_const);
  1151. pattern:=pattern+chr(l);
  1152. end;
  1153. '''' : begin
  1154. repeat
  1155. readchar;
  1156. case c of
  1157. #26 : Message(scan_f_end_of_file);
  1158. newline : Message(scan_f_string_exceeds_line);
  1159. '''' : begin
  1160. readchar;
  1161. if c<>'''' then
  1162. break;
  1163. end;
  1164. end;
  1165. pattern:=pattern+c;
  1166. until false;
  1167. end;
  1168. '^' : begin
  1169. readchar;
  1170. if c<#64 then
  1171. c:=chr(ord(c)+64)
  1172. else
  1173. c:=chr(ord(c)-64);
  1174. pattern:=pattern+c;
  1175. readchar;
  1176. end;
  1177. else
  1178. break;
  1179. end;
  1180. until false;
  1181. { strings with length 1 become const chars }
  1182. if length(pattern)=1 then
  1183. yylex:=CCHAR
  1184. else
  1185. yylex:=CSTRING;
  1186. goto exit_label;
  1187. end;
  1188. '>' : begin
  1189. readchar;
  1190. case c of
  1191. '=' : begin
  1192. readchar;
  1193. yylex:=GTE;
  1194. goto exit_label;
  1195. end;
  1196. '>' : begin
  1197. readchar;
  1198. yylex:=_SHR;
  1199. goto exit_label;
  1200. end;
  1201. '<' : begin { >< is for a symetric diff for sets }
  1202. readchar;
  1203. yylex:=SYMDIF;
  1204. goto exit_label;
  1205. end;
  1206. end;
  1207. yylex:=GT;
  1208. goto exit_label;
  1209. end;
  1210. '<' : begin
  1211. readchar;
  1212. case c of
  1213. '>' : begin
  1214. readchar;
  1215. yylex:=UNEQUAL;
  1216. goto exit_label;
  1217. end;
  1218. '=' : begin
  1219. readchar;
  1220. yylex:=LTE;
  1221. goto exit_label;
  1222. end;
  1223. '<' : begin
  1224. readchar;
  1225. yylex:=_SHL;
  1226. goto exit_label;
  1227. end;
  1228. end;
  1229. yylex:=LT;
  1230. goto exit_label;
  1231. end;
  1232. #26 : begin
  1233. yylex:=_EOF;
  1234. goto exit_label;
  1235. end;
  1236. else
  1237. begin
  1238. Message(scan_f_illegal_char);
  1239. end;
  1240. end;
  1241. end;
  1242. exit_label:
  1243. end;
  1244. function tscannerfile.readpreproc:ttoken;
  1245. begin
  1246. skipspace;
  1247. case c of
  1248. 'A'..'Z',
  1249. 'a'..'z',
  1250. '_','0'..'9' : begin
  1251. preprocpat:=readid;
  1252. readpreproc:=ID;
  1253. end;
  1254. '(' : begin
  1255. readchar;
  1256. readpreproc:=LKLAMMER;
  1257. end;
  1258. ')' : begin
  1259. readchar;
  1260. readpreproc:=RKLAMMER;
  1261. end;
  1262. '+' : begin
  1263. readchar;
  1264. readpreproc:=PLUS;
  1265. end;
  1266. '-' : begin
  1267. readchar;
  1268. readpreproc:=MINUS;
  1269. end;
  1270. '*' : begin
  1271. readchar;
  1272. readpreproc:=STAR;
  1273. end;
  1274. '/' : begin
  1275. readchar;
  1276. readpreproc:=SLASH;
  1277. end;
  1278. '=' : begin
  1279. readchar;
  1280. readpreproc:=EQUAL;
  1281. end;
  1282. '>' : begin
  1283. readchar;
  1284. if c='=' then
  1285. begin
  1286. readchar;
  1287. readpreproc:=GTE;
  1288. end
  1289. else
  1290. readpreproc:=GT;
  1291. end;
  1292. '<' : begin
  1293. readchar;
  1294. case c of
  1295. '>' : begin
  1296. readchar;
  1297. readpreproc:=UNEQUAL;
  1298. end;
  1299. '=' : begin
  1300. readchar;
  1301. readpreproc:=LTE;
  1302. end;
  1303. else readpreproc:=LT;
  1304. end;
  1305. end;
  1306. #26 : Message(scan_f_end_of_file);
  1307. else
  1308. begin
  1309. readpreproc:=_EOF;
  1310. end;
  1311. end;
  1312. end;
  1313. function tscannerfile.asmgetchar : char;
  1314. begin
  1315. if lastasmgetchar<>#0 then
  1316. begin
  1317. c:=lastasmgetchar;
  1318. lastasmgetchar:=#0;
  1319. end
  1320. else
  1321. readchar;
  1322. case c of
  1323. '{' : begin
  1324. skipcomment;
  1325. lastasmgetchar:=c;
  1326. asmgetchar:=';';
  1327. exit;
  1328. end;
  1329. '/' : begin
  1330. readchar;
  1331. if c='/' then
  1332. begin
  1333. skipdelphicomment;
  1334. asmgetchar:=';';
  1335. end
  1336. else
  1337. asmgetchar:='/';
  1338. lastasmgetchar:=c;
  1339. exit;
  1340. end;
  1341. '(' : begin
  1342. readchar;
  1343. if c='*' then
  1344. begin
  1345. skipoldtpcomment;
  1346. asmgetchar:=';';
  1347. end
  1348. else
  1349. asmgetchar:='(';
  1350. lastasmgetchar:=c;
  1351. exit;
  1352. end;
  1353. else
  1354. begin
  1355. asmgetchar:=c;
  1356. end;
  1357. end;
  1358. end;
  1359. end.
  1360. {
  1361. $Log$
  1362. Revision 1.49 1998-09-03 11:24:03 peter
  1363. * moved more inputfile things from tscannerfile to tinputfile
  1364. * changed ifdef Sourceline to cs_asm_source
  1365. Revision 1.48 1998/09/01 12:51:02 peter
  1366. * close also resets lastlinepos
  1367. Revision 1.47 1998/09/01 09:01:52 peter
  1368. * initialize all object variables in .init
  1369. Revision 1.46 1998/08/29 13:49:00 peter
  1370. * fixed freemem calls which had the wrong size sometimes
  1371. Revision 1.45 1998/08/26 15:35:35 peter
  1372. * fixed scannerfiles for macros
  1373. + $I %<environment>%
  1374. Revision 1.44 1998/08/20 16:09:55 pierre
  1375. * tokenpos has to be restored also after
  1376. printstatus
  1377. Revision 1.43 1998/08/20 09:26:45 pierre
  1378. + funcret setting in underproc testing
  1379. compile with _dTEST_FUNCRET
  1380. Revision 1.42 1998/08/19 14:57:51 peter
  1381. * small fix for aktfilepos
  1382. Revision 1.41 1998/08/18 14:17:10 pierre
  1383. * bug about assigning the return value of a function to
  1384. a procvar fixed : warning
  1385. assigning a proc to a procvar need @ in FPC mode !!
  1386. * missing file/line info restored
  1387. Revision 1.40 1998/08/11 14:04:33 peter
  1388. * auto close an open file and better error msg
  1389. Revision 1.39 1998/08/10 14:50:26 peter
  1390. + localswitches, moduleswitches, globalswitches splitting
  1391. Revision 1.38 1998/08/10 10:18:34 peter
  1392. + Compiler,Comphook unit which are the new interface units to the
  1393. compiler
  1394. Revision 1.37 1998/07/23 12:40:41 michael
  1395. No nested comments in Delphi mode.
  1396. Revision 1.36 1998/07/20 22:17:17 florian
  1397. * hex constants in numeric char (#$54#$43 ...) are now allowed
  1398. * there was a bug in record_var_dec which prevents the used
  1399. of nested variant records (for example drivers.tevent of tv)
  1400. Revision 1.35 1998/07/14 21:38:13 peter
  1401. + support for with p^do constructs
  1402. Revision 1.34 1998/07/14 14:47:04 peter
  1403. * released NEWINPUT
  1404. Revision 1.33 1998/07/10 10:48:40 peter
  1405. * fixed realnumber scanning
  1406. * [] after asmblock was not uppercased anymore
  1407. Revision 1.31 1998/07/07 17:39:38 peter
  1408. * fixed $I with following eof
  1409. Revision 1.30 1998/07/07 12:32:55 peter
  1410. * status.currentsource is now calculated in verbose (more accurated)
  1411. Revision 1.29 1998/07/07 11:20:11 peter
  1412. + NEWINPUT for a better inputfile and scanner object
  1413. Revision 1.28 1998/07/01 15:26:57 peter
  1414. * better bufferfile.reset error handling
  1415. Revision 1.27 1998/06/25 08:48:19 florian
  1416. * first version of rtti support
  1417. Revision 1.26 1998/06/16 08:56:30 peter
  1418. + targetcpu
  1419. * cleaner pmodules for newppu
  1420. Revision 1.25 1998/06/13 00:10:15 peter
  1421. * working browser and newppu
  1422. * some small fixes against crashes which occured in bp7 (but not in
  1423. fpc?!)
  1424. Revision 1.24 1998/06/12 10:32:36 pierre
  1425. * column problem hopefully solved
  1426. + C vars declaration changed
  1427. Revision 1.23 1998/06/03 22:49:02 peter
  1428. + wordbool,longbool
  1429. * rename bis,von -> high,low
  1430. * moved some systemunit loading/creating to psystem.pas
  1431. Revision 1.21 1998/05/27 00:20:32 peter
  1432. * some scanner optimizes
  1433. * automaticly aout2exe for go32v1
  1434. * fixed dynamiclinker option which was added at the wrong place
  1435. Revision 1.20 1998/05/23 01:21:30 peter
  1436. + aktasmmode, aktoptprocessor, aktoutputformat
  1437. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  1438. + $LIBNAME to set the library name where the unit will be put in
  1439. * splitted cgi386 a bit (codeseg to large for bp7)
  1440. * nasm, tasm works again. nasm moved to ag386nsm.pas
  1441. Revision 1.19 1998/05/20 09:42:37 pierre
  1442. + UseTokenInfo now default
  1443. * unit in interface uses and implementation uses gives error now
  1444. * only one error for unknown symbol (uses lastsymknown boolean)
  1445. the problem came from the label code !
  1446. + first inlined procedures and function work
  1447. (warning there might be allowed cases were the result is still wrong !!)
  1448. * UseBrower updated gives a global list of all position of all used symbols
  1449. with switch -gb
  1450. Revision 1.18 1998/05/12 10:47:00 peter
  1451. * moved printstatus to verb_def
  1452. + V_Normal which is between V_Error and V_Warning and doesn't have a
  1453. prefix like error: warning: and is included in V_Default
  1454. * fixed some messages
  1455. * first time parameter scan is only for -v and -T
  1456. - removed old style messages
  1457. Revision 1.17 1998/05/06 08:38:47 pierre
  1458. * better position info with UseTokenInfo
  1459. UseTokenInfo greatly simplified
  1460. + added check for changed tree after first time firstpass
  1461. (if we could remove all the cases were it happen
  1462. we could skip all firstpass if firstpasscount > 1)
  1463. Only with ExtDebug
  1464. Revision 1.16 1998/05/04 17:54:28 peter
  1465. + smartlinking works (only case jumptable left todo)
  1466. * redesign of systems.pas to support assemblers and linkers
  1467. + Unitname is now also in the PPU-file, increased version to 14
  1468. Revision 1.15 1998/05/01 16:38:46 florian
  1469. * handling of private and protected fixed
  1470. + change_keywords_to_tp implemented to remove
  1471. keywords which aren't supported by tp
  1472. * break and continue are now symbols of the system unit
  1473. + widestring, longstring and ansistring type released
  1474. Revision 1.14 1998/04/30 15:59:42 pierre
  1475. * GDB works again better :
  1476. correct type info in one pass
  1477. + UseTokenInfo for better source position
  1478. * fixed one remaining bug in scanner for line counts
  1479. * several little fixes
  1480. Revision 1.13 1998/04/29 13:42:27 peter
  1481. + $IOCHECKS and $ALIGN to test already, other will follow soon
  1482. * fixed the wrong linecounting with comments
  1483. Revision 1.12 1998/04/29 10:34:04 pierre
  1484. + added some code for ansistring (not complete nor working yet)
  1485. * corrected operator overloading
  1486. * corrected nasm output
  1487. + started inline procedures
  1488. + added starstarn : use ** for exponentiation (^ gave problems)
  1489. + started UseTokenInfo cond to get accurate positions
  1490. Revision 1.11 1998/04/27 23:10:29 peter
  1491. + new scanner
  1492. * $makelib -> if smartlink
  1493. * small filename fixes pmodule.setfilename
  1494. * moved import from files.pas -> import.pas
  1495. }