scanner.pas 53 KB

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