scanner.pas 53 KB

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