scanner.pas 50 KB

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