scanner.pas 51 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711
  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. 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. gettokenpos; { update for v_status }
  569. inc(status.compiledlines);
  570. ShowStatus;
  571. aktfilepos:=oldaktfilepos;
  572. end;
  573. procedure tscannerfile.checkpreprocstack;
  574. begin
  575. { check for missing ifdefs }
  576. while assigned(preprocstack) do
  577. begin
  578. Message3(scan_e_endif_expected,'$IF(N)(DEF)',preprocstack^.name,tostr(preprocstack^.line_nb));
  579. poppreprocstack;
  580. end;
  581. end;
  582. procedure tscannerfile.poppreprocstack;
  583. var
  584. hp : ppreprocstack;
  585. begin
  586. if assigned(preprocstack) then
  587. begin
  588. hp:=preprocstack^.next;
  589. dispose(preprocstack,done);
  590. preprocstack:=hp;
  591. end
  592. else
  593. Message(scan_e_endif_without_if);
  594. end;
  595. procedure tscannerfile.addpreprocstack(a:boolean;const s:string;w:tmsgconst);
  596. begin
  597. preprocstack:=new(ppreprocstack,init(((preprocstack=nil) or preprocstack^.accept) and a,preprocstack));
  598. preprocstack^.name:=s;
  599. preprocstack^.line_nb:=line_no;
  600. if preprocstack^.accept then
  601. Message2(w,preprocstack^.name,'accepted')
  602. else
  603. Message2(w,preprocstack^.name,'rejected');
  604. end;
  605. procedure tscannerfile.elsepreprocstack;
  606. begin
  607. if assigned(preprocstack) then
  608. begin
  609. if not(assigned(preprocstack^.next)) or (preprocstack^.next^.accept) then
  610. preprocstack^.accept:=not preprocstack^.accept;
  611. if preprocstack^.accept then
  612. Message2(scan_c_else_found,preprocstack^.name,'accepted')
  613. else
  614. Message2(scan_c_else_found,preprocstack^.name,'rejected');
  615. end
  616. else
  617. Message(scan_e_endif_without_if);
  618. end;
  619. procedure tscannerfile.readchar;
  620. begin
  621. c:=inputpointer^;
  622. if c=#0 then
  623. reload
  624. else
  625. inc(longint(inputpointer));
  626. if c in [#10,#13] then
  627. linebreak;
  628. end;
  629. procedure tscannerfile.readstring;
  630. var
  631. i : longint;
  632. begin
  633. i:=0;
  634. repeat
  635. case c of
  636. '_',
  637. '0'..'9',
  638. 'A'..'Z' : begin
  639. if i<255 then
  640. begin
  641. inc(i);
  642. orgpattern[i]:=c;
  643. pattern[i]:=c;
  644. end;
  645. c:=inputpointer^;
  646. inc(longint(inputpointer));
  647. end;
  648. 'a'..'z' : begin
  649. if i<255 then
  650. begin
  651. inc(i);
  652. orgpattern[i]:=c;
  653. pattern[i]:=chr(ord(c)-32)
  654. end;
  655. c:=inputpointer^;
  656. inc(longint(inputpointer));
  657. end;
  658. #0 : reload;
  659. #13,#10 : begin
  660. linebreak;
  661. break;
  662. end;
  663. else
  664. break;
  665. end;
  666. until false;
  667. orgpattern[0]:=chr(i);
  668. pattern[0]:=chr(i);
  669. end;
  670. procedure tscannerfile.readnumber;
  671. var
  672. base,
  673. i : longint;
  674. begin
  675. case c of
  676. '%' : begin
  677. readchar;
  678. base:=2;
  679. pattern[1]:='%';
  680. i:=1;
  681. end;
  682. '$' : begin
  683. readchar;
  684. base:=16;
  685. pattern[1]:='$';
  686. i:=1;
  687. end;
  688. else
  689. begin
  690. base:=10;
  691. i:=0;
  692. end;
  693. end;
  694. while ((base>=10) and (c in ['0'..'9'])) or
  695. ((base=16) and (c in ['A'..'F','a'..'f'])) or
  696. ((base=2) and (c in ['0'..'1'])) do
  697. begin
  698. if i<255 then
  699. begin
  700. inc(i);
  701. pattern[i]:=c;
  702. end;
  703. { get next char }
  704. c:=inputpointer^;
  705. if c=#0 then
  706. reload
  707. else
  708. inc(longint(inputpointer));
  709. end;
  710. { was the next char a linebreak ? }
  711. if c in [#10,#13] then
  712. linebreak;
  713. pattern[0]:=chr(i);
  714. end;
  715. function tscannerfile.readid:string;
  716. begin
  717. readstring;
  718. readid:=pattern;
  719. end;
  720. function tscannerfile.readval:longint;
  721. var
  722. l : longint;
  723. w : word;
  724. begin
  725. readnumber;
  726. valint(pattern,l,w);
  727. readval:=l;
  728. end;
  729. function tscannerfile.readcomment:string;
  730. var
  731. i : longint;
  732. begin
  733. i:=0;
  734. repeat
  735. case c of
  736. '}' : begin
  737. readchar;
  738. dec_comment_level;
  739. break;
  740. end;
  741. #26 : Message(scan_f_end_of_file);
  742. else
  743. begin
  744. if (i<255) then
  745. begin
  746. inc(i);
  747. readcomment[i]:=c;
  748. end;
  749. end;
  750. end;
  751. c:=inputpointer^;
  752. if c=#0 then
  753. reload
  754. else
  755. inc(longint(inputpointer));
  756. if c in [#10,#13] then
  757. linebreak;
  758. until false;
  759. readcomment[0]:=chr(i);
  760. end;
  761. procedure tscannerfile.skipspace;
  762. begin
  763. while c in [' ',#9..#13] do
  764. begin
  765. c:=inputpointer^;
  766. if c=#0 then
  767. reload
  768. else
  769. inc(longint(inputpointer));
  770. if c in [#10,#13] then
  771. linebreak;
  772. end;
  773. end;
  774. procedure tscannerfile.skipuntildirective;
  775. var
  776. found : longint;
  777. begin
  778. found:=0;
  779. repeat
  780. case c of
  781. #26 : Message(scan_f_end_of_file);
  782. '{' : begin
  783. if comment_level=0 then
  784. found:=1;
  785. inc_comment_level;
  786. end;
  787. '}' : begin
  788. dec_comment_level;
  789. found:=0;
  790. end;
  791. '$' : begin
  792. if found=1 then
  793. found:=2;
  794. end;
  795. else
  796. found:=0;
  797. end;
  798. c:=inputpointer^;
  799. if c=#0 then
  800. reload
  801. else
  802. inc(longint(inputpointer));
  803. if c in [#10,#13] then
  804. linebreak;
  805. until (found=2);
  806. end;
  807. {$i scandir.inc}
  808. procedure tscannerfile.skipcomment;
  809. begin
  810. readchar;
  811. inc_comment_level;
  812. { handle compiler switches }
  813. if (c='$') then
  814. handledirectives;
  815. { handle_switches can dec comment_level, }
  816. while (comment_level>0) do
  817. begin
  818. case c of
  819. '{' : inc_comment_level;
  820. '}' : dec_comment_level;
  821. #26 : Message(scan_f_end_of_file);
  822. end;
  823. c:=inputpointer^;
  824. if c=#0 then
  825. reload
  826. else
  827. inc(longint(inputpointer));
  828. if c in [#10,#13] then
  829. linebreak;
  830. end;
  831. end;
  832. procedure tscannerfile.skipdelphicomment;
  833. begin
  834. inc_comment_level;
  835. readchar;
  836. { this is currently not supported }
  837. if c='$' then
  838. Message(scan_e_wrong_styled_switch);
  839. { skip comment }
  840. while c<>newline do
  841. begin
  842. if c=#26 then
  843. Message(scan_f_end_of_file);
  844. readchar;
  845. end;
  846. dec_comment_level;
  847. end;
  848. procedure tscannerfile.skipoldtpcomment;
  849. var
  850. found : longint;
  851. begin
  852. inc_comment_level;
  853. readchar;
  854. { this is currently not supported }
  855. if c='$' then
  856. Message(scan_e_wrong_styled_switch);
  857. { skip comment }
  858. while (comment_level>0) do
  859. begin
  860. found:=0;
  861. repeat
  862. case c of
  863. #26 : Message(scan_f_end_of_file);
  864. '*' : begin
  865. if found=3 then
  866. inc_comment_level
  867. else
  868. found:=1;
  869. end;
  870. ')' : begin
  871. if found=1 then
  872. begin
  873. dec_comment_level;
  874. if comment_level=0 then
  875. found:=2;
  876. end;
  877. end;
  878. '(' : found:=3;
  879. else
  880. found:=0;
  881. end;
  882. c:=inputpointer^;
  883. if c=#0 then
  884. reload
  885. else
  886. inc(longint(inputpointer));
  887. if c in [#10,#13] then
  888. linebreak;
  889. until (found=2);
  890. end;
  891. end;
  892. function tscannerfile.yylex : ttoken;
  893. var
  894. y : ttoken;
  895. code : word;
  896. l : longint;
  897. mac : pmacrosym;
  898. hp : pinputfile;
  899. macbuf : pchar;
  900. asciinr : string[3];
  901. label
  902. exit_label;
  903. begin
  904. { was the last character a point ? }
  905. { this code is needed because the scanner if there is a 1. found if }
  906. { this is a floating point number or range like 1..3 }
  907. if do_special>0 then
  908. begin
  909. gettokenpos;
  910. l:=do_special;
  911. do_special:=0;
  912. case l of
  913. 1 : begin
  914. if c='.' then
  915. begin
  916. readchar;
  917. yylex:=POINTPOINT;
  918. goto exit_label;
  919. end;
  920. yylex:=POINT;
  921. goto exit_label;
  922. end;
  923. 2 : begin
  924. yylex:=CARET;
  925. readchar;
  926. goto exit_label;
  927. end;
  928. end;
  929. end;
  930. { Skip all spaces and comments }
  931. repeat
  932. case c of
  933. '{' : skipcomment;
  934. ' ',#9..#13 : skipspace;
  935. else
  936. break;
  937. end;
  938. until false;
  939. { Save current token position }
  940. gettokenpos;
  941. { Check first for a identifier/keyword, this is 20+% faster (PFV) }
  942. if c in ['_','A'..'Z','a'..'z'] then
  943. begin
  944. readstring;
  945. if (length(pattern) in [2..id_len]) and is_keyword(y) then
  946. yylex:=y
  947. else
  948. begin
  949. { this takes some time ... }
  950. if (cs_support_macro in aktmoduleswitches) then
  951. begin
  952. mac:=pmacrosym(macros^.search(pattern));
  953. if assigned(mac) and (assigned(mac^.buftext)) then
  954. begin
  955. { don't forget the last char }
  956. dec(longint(inputpointer));
  957. hp:=new(pinputfile,init('Macro '+pattern));
  958. addfile(hp);
  959. getmem(macbuf,mac^.buflen+1);
  960. setbuf(macbuf,mac^.buflen+1);
  961. { copy text }
  962. move(mac^.buftext^,inputbuffer^,mac^.buflen);
  963. { put end sign }
  964. inputbuffer[mac^.buflen+1]:=#0;
  965. { load c }
  966. c:=inputbuffer^;
  967. inputpointer:=inputbuffer+1;
  968. { handle empty macros }
  969. if c=#0 then
  970. reload;
  971. { play it again ... }
  972. inc(yylexcount);
  973. if yylexcount>16 then
  974. Message(scan_w_macro_deep_ten);
  975. {$ifdef TP}
  976. yylex:=yylex;
  977. {$else}
  978. yylex:=yylex();
  979. {$endif}
  980. { that's all folks }
  981. dec(yylexcount);
  982. exit;
  983. end;
  984. end;
  985. yylex:=ID;
  986. end;
  987. if (c='^') then
  988. do_special:=2;
  989. goto exit_label;
  990. end
  991. else
  992. begin
  993. case c of
  994. '$' : begin
  995. readnumber;
  996. yylex:=INTCONST;
  997. goto exit_label;
  998. end;
  999. '%' : begin
  1000. readnumber;
  1001. yylex:=INTCONST;
  1002. goto exit_label;
  1003. end;
  1004. '0'..'9' : begin
  1005. readnumber;
  1006. if (c in ['.','e','E']) then
  1007. begin
  1008. { first check for a . }
  1009. if c='.' then
  1010. begin
  1011. readchar;
  1012. if not(c in ['0'..'9']) then
  1013. begin
  1014. do_special:=1;
  1015. yylex:=INTCONST;
  1016. goto exit_label;
  1017. end;
  1018. pattern:=pattern+'.';
  1019. while c in ['0'..'9'] do
  1020. begin
  1021. pattern:=pattern+c;
  1022. readchar;
  1023. end;
  1024. end;
  1025. { E can also follow after a point is scanned }
  1026. if c in ['e','E'] then
  1027. begin
  1028. pattern:=pattern+'E';
  1029. readchar;
  1030. if c in ['-','+'] then
  1031. begin
  1032. pattern:=pattern+c;
  1033. readchar;
  1034. end;
  1035. if not(c in ['0'..'9']) then
  1036. Message(scan_f_illegal_char);
  1037. while c in ['0'..'9'] do
  1038. begin
  1039. pattern:=pattern+c;
  1040. readchar;
  1041. end;
  1042. end;
  1043. yylex:=REALNUMBER;
  1044. goto exit_label;
  1045. end;
  1046. yylex:=INTCONST;
  1047. goto exit_label;
  1048. end;
  1049. ';' : begin
  1050. readchar;
  1051. yylex:=SEMICOLON;
  1052. goto exit_label;
  1053. end;
  1054. '[' : begin
  1055. readchar;
  1056. yylex:=LECKKLAMMER;
  1057. goto exit_label;
  1058. end;
  1059. ']' : begin
  1060. readchar;
  1061. yylex:=RECKKLAMMER;
  1062. goto exit_label;
  1063. end;
  1064. '(' : begin
  1065. readchar;
  1066. if c='*' then
  1067. begin
  1068. skipoldtpcomment;
  1069. {$ifndef TP}
  1070. yylex:=yylex();
  1071. {$else}
  1072. yylex:=yylex;
  1073. {$endif}
  1074. exit;
  1075. end;
  1076. yylex:=LKLAMMER;
  1077. goto exit_label;
  1078. end;
  1079. ')' : begin
  1080. readchar;
  1081. yylex:=RKLAMMER;
  1082. goto exit_label;
  1083. end;
  1084. '+' : begin
  1085. readchar;
  1086. if (c='=') and (cs_support_c_operators in aktmoduleswitches) then
  1087. begin
  1088. readchar;
  1089. yylex:=_PLUSASN;
  1090. goto exit_label;
  1091. end;
  1092. yylex:=PLUS;
  1093. goto exit_label;
  1094. end;
  1095. '-' : begin
  1096. readchar;
  1097. if (c='=') and (cs_support_c_operators in aktmoduleswitches) then
  1098. begin
  1099. readchar;
  1100. yylex:=_MINUSASN;
  1101. goto exit_label;
  1102. end;
  1103. yylex:=MINUS;
  1104. goto exit_label;
  1105. end;
  1106. ':' : begin
  1107. readchar;
  1108. if c='=' then
  1109. begin
  1110. readchar;
  1111. yylex:=ASSIGNMENT;
  1112. goto exit_label;
  1113. end;
  1114. yylex:=COLON;
  1115. goto exit_label;
  1116. end;
  1117. '*' : begin
  1118. readchar;
  1119. if (c='=') and (cs_support_c_operators in aktmoduleswitches) then
  1120. begin
  1121. readchar;
  1122. yylex:=_STARASN;
  1123. end
  1124. else
  1125. if c='*' then
  1126. begin
  1127. readchar;
  1128. yylex:=STARSTAR;
  1129. end
  1130. else
  1131. yylex:=STAR;
  1132. goto exit_label;
  1133. end;
  1134. '/' : begin
  1135. readchar;
  1136. case c of
  1137. '=' : begin
  1138. if (cs_support_c_operators in aktmoduleswitches) then
  1139. begin
  1140. readchar;
  1141. yylex:=_SLASHASN;
  1142. goto exit_label;
  1143. end;
  1144. end;
  1145. '/' : begin
  1146. skipdelphicomment;
  1147. {$ifndef TP}
  1148. yylex:=yylex();
  1149. {$else TP}
  1150. yylex:=yylex;
  1151. {$endif TP}
  1152. exit;
  1153. end;
  1154. end;
  1155. yylex:=SLASH;
  1156. goto exit_label;
  1157. end;
  1158. '=' : begin
  1159. readchar;
  1160. yylex:=EQUAL;
  1161. goto exit_label;
  1162. end;
  1163. '.' : begin
  1164. readchar;
  1165. if c='.' then
  1166. begin
  1167. readchar;
  1168. yylex:=POINTPOINT;
  1169. goto exit_label;
  1170. end
  1171. else
  1172. yylex:=POINT;
  1173. goto exit_label;
  1174. end;
  1175. '@' : begin
  1176. readchar;
  1177. if c='@' then
  1178. begin
  1179. readchar;
  1180. yylex:=DOUBLEADDR;
  1181. end
  1182. else
  1183. yylex:=KLAMMERAFFE;
  1184. goto exit_label;
  1185. end;
  1186. ',' : begin
  1187. readchar;
  1188. yylex:=COMMA;
  1189. goto exit_label;
  1190. end;
  1191. '''','#','^' : begin
  1192. if c='^' then
  1193. begin
  1194. readchar;
  1195. c:=upcase(c);
  1196. if not(block_type=bt_type) and (c in ['A'..'Z']) then
  1197. begin
  1198. pattern:=chr(ord(c)-64);
  1199. readchar;
  1200. end
  1201. else
  1202. begin
  1203. yylex:=CARET;
  1204. goto exit_label;
  1205. end;
  1206. end
  1207. else
  1208. pattern:='';
  1209. repeat
  1210. case c of
  1211. '#' : begin
  1212. readchar; { read # }
  1213. if c='$' then
  1214. begin
  1215. readchar; { read leading $ }
  1216. asciinr:='$';
  1217. while (upcase(c) in ['A'..'F','0'..'9']) and (length(asciinr)<3) do
  1218. begin
  1219. asciinr:=asciinr+c;
  1220. readchar;
  1221. end;
  1222. end
  1223. else
  1224. begin
  1225. asciinr:='';
  1226. while (c in ['0'..'9']) and (length(asciinr)<3) do
  1227. begin
  1228. asciinr:=asciinr+c;
  1229. readchar;
  1230. end;
  1231. end;
  1232. valint(asciinr,l,code);
  1233. if (asciinr='') or (code<>0) or
  1234. (l<0) or (l>255) then
  1235. Message(scan_e_illegal_char_const);
  1236. pattern:=pattern+chr(l);
  1237. end;
  1238. '''' : begin
  1239. repeat
  1240. readchar;
  1241. case c of
  1242. #26 : Message(scan_f_end_of_file);
  1243. newline : Message(scan_f_string_exceeds_line);
  1244. '''' : begin
  1245. readchar;
  1246. if c<>'''' then
  1247. break;
  1248. end;
  1249. end;
  1250. pattern:=pattern+c;
  1251. until false;
  1252. end;
  1253. '^' : begin
  1254. readchar;
  1255. if c<#64 then
  1256. c:=chr(ord(c)+64)
  1257. else
  1258. c:=chr(ord(c)-64);
  1259. pattern:=pattern+c;
  1260. readchar;
  1261. end;
  1262. else
  1263. break;
  1264. end;
  1265. until false;
  1266. { strings with length 1 become const chars }
  1267. if length(pattern)=1 then
  1268. yylex:=CCHAR
  1269. else
  1270. yylex:=CSTRING;
  1271. goto exit_label;
  1272. end;
  1273. '>' : begin
  1274. readchar;
  1275. case c of
  1276. '=' : begin
  1277. readchar;
  1278. yylex:=GTE;
  1279. goto exit_label;
  1280. end;
  1281. '>' : begin
  1282. readchar;
  1283. yylex:=_SHR;
  1284. goto exit_label;
  1285. end;
  1286. '<' : begin { >< is for a symetric diff for sets }
  1287. readchar;
  1288. yylex:=SYMDIF;
  1289. goto exit_label;
  1290. end;
  1291. end;
  1292. yylex:=GT;
  1293. goto exit_label;
  1294. end;
  1295. '<' : begin
  1296. readchar;
  1297. case c of
  1298. '>' : begin
  1299. readchar;
  1300. yylex:=UNEQUAL;
  1301. goto exit_label;
  1302. end;
  1303. '=' : begin
  1304. readchar;
  1305. yylex:=LTE;
  1306. goto exit_label;
  1307. end;
  1308. '<' : begin
  1309. readchar;
  1310. yylex:=_SHL;
  1311. goto exit_label;
  1312. end;
  1313. end;
  1314. yylex:=LT;
  1315. goto exit_label;
  1316. end;
  1317. #26 : begin
  1318. yylex:=_EOF;
  1319. goto exit_label;
  1320. end;
  1321. else
  1322. begin
  1323. Message(scan_f_illegal_char);
  1324. end;
  1325. end;
  1326. end;
  1327. exit_label:
  1328. end;
  1329. function tscannerfile.readpreproc:ttoken;
  1330. begin
  1331. skipspace;
  1332. case c of
  1333. 'A'..'Z',
  1334. 'a'..'z',
  1335. '_','0'..'9' : begin
  1336. preprocpat:=readid;
  1337. readpreproc:=ID;
  1338. end;
  1339. '(' : begin
  1340. readchar;
  1341. readpreproc:=LKLAMMER;
  1342. end;
  1343. ')' : begin
  1344. readchar;
  1345. readpreproc:=RKLAMMER;
  1346. end;
  1347. '+' : begin
  1348. readchar;
  1349. readpreproc:=PLUS;
  1350. end;
  1351. '-' : begin
  1352. readchar;
  1353. readpreproc:=MINUS;
  1354. end;
  1355. '*' : begin
  1356. readchar;
  1357. readpreproc:=STAR;
  1358. end;
  1359. '/' : begin
  1360. readchar;
  1361. readpreproc:=SLASH;
  1362. end;
  1363. '=' : begin
  1364. readchar;
  1365. readpreproc:=EQUAL;
  1366. end;
  1367. '>' : begin
  1368. readchar;
  1369. if c='=' then
  1370. begin
  1371. readchar;
  1372. readpreproc:=GTE;
  1373. end
  1374. else
  1375. readpreproc:=GT;
  1376. end;
  1377. '<' : begin
  1378. readchar;
  1379. case c of
  1380. '>' : begin
  1381. readchar;
  1382. readpreproc:=UNEQUAL;
  1383. end;
  1384. '=' : begin
  1385. readchar;
  1386. readpreproc:=LTE;
  1387. end;
  1388. else readpreproc:=LT;
  1389. end;
  1390. end;
  1391. #26 : Message(scan_f_end_of_file);
  1392. else
  1393. begin
  1394. readpreproc:=_EOF;
  1395. end;
  1396. end;
  1397. end;
  1398. function tscannerfile.asmgetchar : char;
  1399. begin
  1400. if lastasmgetchar<>#0 then
  1401. begin
  1402. c:=lastasmgetchar;
  1403. lastasmgetchar:=#0;
  1404. end
  1405. else
  1406. readchar;
  1407. case c of
  1408. '{' : begin
  1409. skipcomment;
  1410. lastasmgetchar:=c;
  1411. asmgetchar:=';';
  1412. exit;
  1413. end;
  1414. '/' : begin
  1415. readchar;
  1416. if c='/' then
  1417. begin
  1418. skipdelphicomment;
  1419. asmgetchar:=';';
  1420. end
  1421. else
  1422. asmgetchar:='/';
  1423. lastasmgetchar:=c;
  1424. exit;
  1425. end;
  1426. '(' : begin
  1427. readchar;
  1428. if c='*' then
  1429. begin
  1430. skipoldtpcomment;
  1431. asmgetchar:=';';
  1432. end
  1433. else
  1434. asmgetchar:='(';
  1435. lastasmgetchar:=c;
  1436. exit;
  1437. end;
  1438. else
  1439. begin
  1440. asmgetchar:=c;
  1441. end;
  1442. end;
  1443. end;
  1444. end.
  1445. {
  1446. $Log$
  1447. Revision 1.43 1998-08-20 09:26:45 pierre
  1448. + funcret setting in underproc testing
  1449. compile with _dTEST_FUNCRET
  1450. Revision 1.42 1998/08/19 14:57:51 peter
  1451. * small fix for aktfilepos
  1452. Revision 1.41 1998/08/18 14:17:10 pierre
  1453. * bug about assigning the return value of a function to
  1454. a procvar fixed : warning
  1455. assigning a proc to a procvar need @ in FPC mode !!
  1456. * missing file/line info restored
  1457. Revision 1.40 1998/08/11 14:04:33 peter
  1458. * auto close an open file and better error msg
  1459. Revision 1.39 1998/08/10 14:50:26 peter
  1460. + localswitches, moduleswitches, globalswitches splitting
  1461. Revision 1.38 1998/08/10 10:18:34 peter
  1462. + Compiler,Comphook unit which are the new interface units to the
  1463. compiler
  1464. Revision 1.37 1998/07/23 12:40:41 michael
  1465. No nested comments in Delphi mode.
  1466. Revision 1.36 1998/07/20 22:17:17 florian
  1467. * hex constants in numeric char (#$54#$43 ...) are now allowed
  1468. * there was a bug in record_var_dec which prevents the used
  1469. of nested variant records (for example drivers.tevent of tv)
  1470. Revision 1.35 1998/07/14 21:38:13 peter
  1471. + support for with p^do constructs
  1472. Revision 1.34 1998/07/14 14:47:04 peter
  1473. * released NEWINPUT
  1474. Revision 1.33 1998/07/10 10:48:40 peter
  1475. * fixed realnumber scanning
  1476. * [] after asmblock was not uppercased anymore
  1477. Revision 1.31 1998/07/07 17:39:38 peter
  1478. * fixed $I with following eof
  1479. Revision 1.30 1998/07/07 12:32:55 peter
  1480. * status.currentsource is now calculated in verbose (more accurated)
  1481. Revision 1.29 1998/07/07 11:20:11 peter
  1482. + NEWINPUT for a better inputfile and scanner object
  1483. Revision 1.28 1998/07/01 15:26:57 peter
  1484. * better bufferfile.reset error handling
  1485. Revision 1.27 1998/06/25 08:48:19 florian
  1486. * first version of rtti support
  1487. Revision 1.26 1998/06/16 08:56:30 peter
  1488. + targetcpu
  1489. * cleaner pmodules for newppu
  1490. Revision 1.25 1998/06/13 00:10:15 peter
  1491. * working browser and newppu
  1492. * some small fixes against crashes which occured in bp7 (but not in
  1493. fpc?!)
  1494. Revision 1.24 1998/06/12 10:32:36 pierre
  1495. * column problem hopefully solved
  1496. + C vars declaration changed
  1497. Revision 1.23 1998/06/03 22:49:02 peter
  1498. + wordbool,longbool
  1499. * rename bis,von -> high,low
  1500. * moved some systemunit loading/creating to psystem.pas
  1501. Revision 1.21 1998/05/27 00:20:32 peter
  1502. * some scanner optimizes
  1503. * automaticly aout2exe for go32v1
  1504. * fixed dynamiclinker option which was added at the wrong place
  1505. Revision 1.20 1998/05/23 01:21:30 peter
  1506. + aktasmmode, aktoptprocessor, aktoutputformat
  1507. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  1508. + $LIBNAME to set the library name where the unit will be put in
  1509. * splitted cgi386 a bit (codeseg to large for bp7)
  1510. * nasm, tasm works again. nasm moved to ag386nsm.pas
  1511. Revision 1.19 1998/05/20 09:42:37 pierre
  1512. + UseTokenInfo now default
  1513. * unit in interface uses and implementation uses gives error now
  1514. * only one error for unknown symbol (uses lastsymknown boolean)
  1515. the problem came from the label code !
  1516. + first inlined procedures and function work
  1517. (warning there might be allowed cases were the result is still wrong !!)
  1518. * UseBrower updated gives a global list of all position of all used symbols
  1519. with switch -gb
  1520. Revision 1.18 1998/05/12 10:47:00 peter
  1521. * moved printstatus to verb_def
  1522. + V_Normal which is between V_Error and V_Warning and doesn't have a
  1523. prefix like error: warning: and is included in V_Default
  1524. * fixed some messages
  1525. * first time parameter scan is only for -v and -T
  1526. - removed old style messages
  1527. Revision 1.17 1998/05/06 08:38:47 pierre
  1528. * better position info with UseTokenInfo
  1529. UseTokenInfo greatly simplified
  1530. + added check for changed tree after first time firstpass
  1531. (if we could remove all the cases were it happen
  1532. we could skip all firstpass if firstpasscount > 1)
  1533. Only with ExtDebug
  1534. Revision 1.16 1998/05/04 17:54:28 peter
  1535. + smartlinking works (only case jumptable left todo)
  1536. * redesign of systems.pas to support assemblers and linkers
  1537. + Unitname is now also in the PPU-file, increased version to 14
  1538. Revision 1.15 1998/05/01 16:38:46 florian
  1539. * handling of private and protected fixed
  1540. + change_keywords_to_tp implemented to remove
  1541. keywords which aren't supported by tp
  1542. * break and continue are now symbols of the system unit
  1543. + widestring, longstring and ansistring type released
  1544. Revision 1.14 1998/04/30 15:59:42 pierre
  1545. * GDB works again better :
  1546. correct type info in one pass
  1547. + UseTokenInfo for better source position
  1548. * fixed one remaining bug in scanner for line counts
  1549. * several little fixes
  1550. Revision 1.13 1998/04/29 13:42:27 peter
  1551. + $IOCHECKS and $ALIGN to test already, other will follow soon
  1552. * fixed the wrong linecounting with comments
  1553. Revision 1.12 1998/04/29 10:34:04 pierre
  1554. + added some code for ansistring (not complete nor working yet)
  1555. * corrected operator overloading
  1556. * corrected nasm output
  1557. + started inline procedures
  1558. + added starstarn : use ** for exponentiation (^ gave problems)
  1559. + started UseTokenInfo cond to get accurate positions
  1560. Revision 1.11 1998/04/27 23:10:29 peter
  1561. + new scanner
  1562. * $makelib -> if smartlink
  1563. * small filename fixes pmodule.setfilename
  1564. * moved import from files.pas -> import.pas
  1565. }