scanner.pas 48 KB

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