scanner.pas 53 KB

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