scanner.pas 51 KB

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