scanner.pas 51 KB

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