2
0

scanner.pas 51 KB

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