scanner.pas 51 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697
  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 (m_nested_comment in aktmodeswitches) then
  459. dec(comment_level)
  460. else
  461. comment_level:=0;
  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 : integer;
  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. function tscannerfile.readstate:char;
  691. var
  692. state : char;
  693. begin
  694. state:=' ';
  695. if c=' ' then
  696. begin
  697. current_scanner^.skipspace;
  698. current_scanner^.readid;
  699. if pattern='ON' then
  700. state:='+'
  701. else
  702. if pattern='OFF' then
  703. state:='-';
  704. end
  705. else
  706. state:=c;
  707. if not (state in ['+','-']) then
  708. Message(scan_e_wrong_switch_toggle);
  709. readstate:=state;
  710. end;
  711. procedure tscannerfile.skipspace;
  712. begin
  713. while c in [' ',#9..#13] do
  714. begin
  715. c:=inputpointer^;
  716. if c=#0 then
  717. reload
  718. else
  719. inc(longint(inputpointer));
  720. if c in [#10,#13] then
  721. linebreak;
  722. end;
  723. end;
  724. procedure tscannerfile.skipuntildirective;
  725. var
  726. found : longint;
  727. begin
  728. found:=0;
  729. repeat
  730. case c of
  731. #26 : Message(scan_f_end_of_file);
  732. '{' : begin
  733. if comment_level=0 then
  734. found:=1;
  735. inc_comment_level;
  736. end;
  737. '}' : begin
  738. dec_comment_level;
  739. found:=0;
  740. end;
  741. '$' : begin
  742. if found=1 then
  743. found:=2;
  744. end;
  745. else
  746. found:=0;
  747. end;
  748. c:=inputpointer^;
  749. if c=#0 then
  750. reload
  751. else
  752. inc(longint(inputpointer));
  753. if c in [#10,#13] then
  754. linebreak;
  755. until (found=2);
  756. end;
  757. {$i scandir.inc}
  758. procedure tscannerfile.skipcomment;
  759. begin
  760. readchar;
  761. inc_comment_level;
  762. { handle compiler switches }
  763. if (c='$') then
  764. handledirectives;
  765. { handle_switches can dec comment_level, }
  766. while (comment_level>0) do
  767. begin
  768. case c of
  769. '{' : inc_comment_level;
  770. '}' : dec_comment_level;
  771. #26 : Message(scan_f_end_of_file);
  772. end;
  773. c:=inputpointer^;
  774. if c=#0 then
  775. reload
  776. else
  777. inc(longint(inputpointer));
  778. if c in [#10,#13] then
  779. linebreak;
  780. end;
  781. end;
  782. procedure tscannerfile.skipdelphicomment;
  783. begin
  784. inc_comment_level;
  785. readchar;
  786. { this is currently not supported }
  787. if c='$' then
  788. Message(scan_e_wrong_styled_switch);
  789. { skip comment }
  790. while c<>newline do
  791. begin
  792. if c=#26 then
  793. Message(scan_f_end_of_file);
  794. readchar;
  795. end;
  796. dec_comment_level;
  797. end;
  798. procedure tscannerfile.skipoldtpcomment;
  799. var
  800. found : longint;
  801. begin
  802. inc_comment_level;
  803. readchar;
  804. { this is currently not supported }
  805. if c='$' then
  806. Message(scan_e_wrong_styled_switch);
  807. { skip comment }
  808. while (comment_level>0) do
  809. begin
  810. found:=0;
  811. repeat
  812. case c of
  813. #26 : Message(scan_f_end_of_file);
  814. '*' : begin
  815. if found=3 then
  816. inc_comment_level
  817. else
  818. found:=1;
  819. end;
  820. ')' : begin
  821. if found=1 then
  822. begin
  823. dec_comment_level;
  824. if comment_level=0 then
  825. found:=2;
  826. end;
  827. end;
  828. '(' : found:=3;
  829. else
  830. found:=0;
  831. end;
  832. c:=inputpointer^;
  833. if c=#0 then
  834. reload
  835. else
  836. inc(longint(inputpointer));
  837. if c in [#10,#13] then
  838. linebreak;
  839. until (found=2);
  840. end;
  841. end;
  842. function tscannerfile.yylex : ttoken;
  843. var
  844. y : ttoken;
  845. code : integer;
  846. l : longint;
  847. mac : pmacrosym;
  848. asciinr : string[3];
  849. label
  850. exit_label;
  851. begin
  852. { was the last character a point ? }
  853. { this code is needed because the scanner if there is a 1. found if }
  854. { this is a floating point number or range like 1..3 }
  855. if do_special>0 then
  856. begin
  857. gettokenpos;
  858. l:=do_special;
  859. do_special:=0;
  860. case l of
  861. 1 : begin { first char was a point }
  862. case c of
  863. '.' : begin
  864. readchar;
  865. yylex:=POINTPOINT;
  866. goto exit_label;
  867. end;
  868. ')' : begin
  869. readchar;
  870. yylex:=RECKKLAMMER;
  871. goto exit_label;
  872. end;
  873. end;
  874. yylex:=POINT;
  875. goto exit_label;
  876. end;
  877. 2 : begin { first char was a Caret }
  878. yylex:=CARET;
  879. readchar;
  880. goto exit_label;
  881. end;
  882. end;
  883. end;
  884. { Skip all spaces and comments }
  885. repeat
  886. case c of
  887. '{' : skipcomment;
  888. ' ',#9..#13 : skipspace;
  889. else
  890. break;
  891. end;
  892. until false;
  893. { Save current token position }
  894. gettokenpos;
  895. { Check first for a identifier/keyword, this is 20+% faster (PFV) }
  896. if c in ['_','A'..'Z','a'..'z'] then
  897. begin
  898. readstring;
  899. if (length(pattern) in [2..id_len]) and is_keyword(y) then
  900. yylex:=y
  901. else
  902. begin
  903. { this takes some time ... }
  904. if (cs_support_macro in aktmoduleswitches) then
  905. begin
  906. mac:=pmacrosym(macros^.search(pattern));
  907. if assigned(mac) and (assigned(mac^.buftext)) then
  908. begin
  909. insertmacro(mac^.buftext,mac^.buflen);
  910. { handle empty macros }
  911. if c=#0 then
  912. reload;
  913. { play it again ... }
  914. inc(yylexcount);
  915. if yylexcount>16 then
  916. Message(scan_w_macro_deep_ten);
  917. {$ifdef TP}
  918. yylex:=yylex;
  919. {$else}
  920. yylex:=yylex();
  921. {$endif}
  922. { that's all folks }
  923. dec(yylexcount);
  924. exit;
  925. end;
  926. end;
  927. yylex:=ID;
  928. end;
  929. if (c='^') then
  930. do_special:=2;
  931. goto exit_label;
  932. end
  933. else
  934. begin
  935. case c of
  936. '$' : begin
  937. readnumber;
  938. yylex:=INTCONST;
  939. goto exit_label;
  940. end;
  941. '%' : begin
  942. readnumber;
  943. yylex:=INTCONST;
  944. goto exit_label;
  945. end;
  946. '0'..'9' : begin
  947. readnumber;
  948. if (c in ['.','e','E']) then
  949. begin
  950. { first check for a . }
  951. if c='.' then
  952. begin
  953. readchar;
  954. if not(c in ['0'..'9']) then
  955. begin
  956. do_special:=1;
  957. yylex:=INTCONST;
  958. goto exit_label;
  959. end;
  960. pattern:=pattern+'.';
  961. while c in ['0'..'9'] do
  962. begin
  963. pattern:=pattern+c;
  964. readchar;
  965. end;
  966. end;
  967. { E can also follow after a point is scanned }
  968. if c in ['e','E'] then
  969. begin
  970. pattern:=pattern+'E';
  971. readchar;
  972. if c in ['-','+'] then
  973. begin
  974. pattern:=pattern+c;
  975. readchar;
  976. end;
  977. if not(c in ['0'..'9']) then
  978. Message(scan_f_illegal_char);
  979. while c in ['0'..'9'] do
  980. begin
  981. pattern:=pattern+c;
  982. readchar;
  983. end;
  984. end;
  985. yylex:=REALNUMBER;
  986. goto exit_label;
  987. end;
  988. yylex:=INTCONST;
  989. goto exit_label;
  990. end;
  991. ';' : begin
  992. readchar;
  993. yylex:=SEMICOLON;
  994. goto exit_label;
  995. end;
  996. '[' : begin
  997. readchar;
  998. yylex:=LECKKLAMMER;
  999. goto exit_label;
  1000. end;
  1001. ']' : begin
  1002. readchar;
  1003. yylex:=RECKKLAMMER;
  1004. goto exit_label;
  1005. end;
  1006. '(' : begin
  1007. readchar;
  1008. case c of
  1009. '*' : begin
  1010. skipoldtpcomment;
  1011. {$ifndef TP}
  1012. yylex:=yylex();
  1013. {$else}
  1014. yylex:=yylex;
  1015. {$endif}
  1016. exit;
  1017. end;
  1018. '.' : begin
  1019. readchar;
  1020. yylex:=LECKKLAMMER;
  1021. goto exit_label;
  1022. end;
  1023. end;
  1024. yylex:=LKLAMMER;
  1025. goto exit_label;
  1026. end;
  1027. ')' : begin
  1028. readchar;
  1029. yylex:=RKLAMMER;
  1030. goto exit_label;
  1031. end;
  1032. '+' : begin
  1033. readchar;
  1034. if (c='=') and (cs_support_c_operators in aktmoduleswitches) then
  1035. begin
  1036. readchar;
  1037. yylex:=_PLUSASN;
  1038. goto exit_label;
  1039. end;
  1040. yylex:=PLUS;
  1041. goto exit_label;
  1042. end;
  1043. '-' : begin
  1044. readchar;
  1045. if (c='=') and (cs_support_c_operators in aktmoduleswitches) then
  1046. begin
  1047. readchar;
  1048. yylex:=_MINUSASN;
  1049. goto exit_label;
  1050. end;
  1051. yylex:=MINUS;
  1052. goto exit_label;
  1053. end;
  1054. ':' : begin
  1055. readchar;
  1056. if c='=' then
  1057. begin
  1058. readchar;
  1059. yylex:=ASSIGNMENT;
  1060. goto exit_label;
  1061. end;
  1062. yylex:=COLON;
  1063. goto exit_label;
  1064. end;
  1065. '*' : begin
  1066. readchar;
  1067. if (c='=') and (cs_support_c_operators in aktmoduleswitches) then
  1068. begin
  1069. readchar;
  1070. yylex:=_STARASN;
  1071. end
  1072. else
  1073. if c='*' then
  1074. begin
  1075. readchar;
  1076. yylex:=STARSTAR;
  1077. end
  1078. else
  1079. yylex:=STAR;
  1080. goto exit_label;
  1081. end;
  1082. '/' : begin
  1083. readchar;
  1084. case c of
  1085. '=' : begin
  1086. if (cs_support_c_operators in aktmoduleswitches) then
  1087. begin
  1088. readchar;
  1089. yylex:=_SLASHASN;
  1090. goto exit_label;
  1091. end;
  1092. end;
  1093. '/' : begin
  1094. skipdelphicomment;
  1095. {$ifndef TP}
  1096. yylex:=yylex();
  1097. {$else TP}
  1098. yylex:=yylex;
  1099. {$endif TP}
  1100. exit;
  1101. end;
  1102. end;
  1103. yylex:=SLASH;
  1104. goto exit_label;
  1105. end;
  1106. '=' : begin
  1107. readchar;
  1108. yylex:=EQUAL;
  1109. goto exit_label;
  1110. end;
  1111. '.' : begin
  1112. readchar;
  1113. case c of
  1114. '.' : begin
  1115. readchar;
  1116. yylex:=POINTPOINT;
  1117. goto exit_label;
  1118. end;
  1119. ')' : begin
  1120. readchar;
  1121. yylex:=RECKKLAMMER;
  1122. goto exit_label;
  1123. end;
  1124. end;
  1125. yylex:=POINT;
  1126. goto exit_label;
  1127. end;
  1128. '@' : begin
  1129. readchar;
  1130. if c='@' then
  1131. begin
  1132. readchar;
  1133. yylex:=DOUBLEADDR;
  1134. end
  1135. else
  1136. yylex:=KLAMMERAFFE;
  1137. goto exit_label;
  1138. end;
  1139. ',' : begin
  1140. readchar;
  1141. yylex:=COMMA;
  1142. goto exit_label;
  1143. end;
  1144. '''','#','^' : begin
  1145. if c='^' then
  1146. begin
  1147. readchar;
  1148. c:=upcase(c);
  1149. if not(block_type=bt_type) and (c in ['A'..'Z']) then
  1150. begin
  1151. pattern:=chr(ord(c)-64);
  1152. readchar;
  1153. end
  1154. else
  1155. begin
  1156. yylex:=CARET;
  1157. goto exit_label;
  1158. end;
  1159. end
  1160. else
  1161. pattern:='';
  1162. repeat
  1163. case c of
  1164. '#' : begin
  1165. readchar; { read # }
  1166. if c='$' then
  1167. begin
  1168. readchar; { read leading $ }
  1169. asciinr:='$';
  1170. while (upcase(c) in ['A'..'F','0'..'9']) and (length(asciinr)<3) do
  1171. begin
  1172. asciinr:=asciinr+c;
  1173. readchar;
  1174. end;
  1175. end
  1176. else
  1177. begin
  1178. asciinr:='';
  1179. while (c in ['0'..'9']) and (length(asciinr)<3) do
  1180. begin
  1181. asciinr:=asciinr+c;
  1182. readchar;
  1183. end;
  1184. end;
  1185. valint(asciinr,l,code);
  1186. if (asciinr='') or (code<>0) or
  1187. (l<0) or (l>255) then
  1188. Message(scan_e_illegal_char_const);
  1189. pattern:=pattern+chr(l);
  1190. end;
  1191. '''' : begin
  1192. repeat
  1193. readchar;
  1194. case c of
  1195. #26 : Message(scan_f_end_of_file);
  1196. newline : Message(scan_f_string_exceeds_line);
  1197. '''' : begin
  1198. readchar;
  1199. if c<>'''' then
  1200. break;
  1201. end;
  1202. end;
  1203. pattern:=pattern+c;
  1204. until false;
  1205. end;
  1206. '^' : begin
  1207. readchar;
  1208. if c<#64 then
  1209. c:=chr(ord(c)+64)
  1210. else
  1211. c:=chr(ord(c)-64);
  1212. pattern:=pattern+c;
  1213. readchar;
  1214. end;
  1215. else
  1216. break;
  1217. end;
  1218. until false;
  1219. { strings with length 1 become const chars }
  1220. if length(pattern)=1 then
  1221. yylex:=CCHAR
  1222. else
  1223. yylex:=CSTRING;
  1224. goto exit_label;
  1225. end;
  1226. '>' : begin
  1227. readchar;
  1228. case c of
  1229. '=' : begin
  1230. readchar;
  1231. yylex:=GTE;
  1232. goto exit_label;
  1233. end;
  1234. '>' : begin
  1235. readchar;
  1236. yylex:=_SHR;
  1237. goto exit_label;
  1238. end;
  1239. '<' : begin { >< is for a symetric diff for sets }
  1240. readchar;
  1241. yylex:=SYMDIF;
  1242. goto exit_label;
  1243. end;
  1244. end;
  1245. yylex:=GT;
  1246. goto exit_label;
  1247. end;
  1248. '<' : begin
  1249. readchar;
  1250. case c of
  1251. '>' : begin
  1252. readchar;
  1253. yylex:=UNEQUAL;
  1254. goto exit_label;
  1255. end;
  1256. '=' : begin
  1257. readchar;
  1258. yylex:=LTE;
  1259. goto exit_label;
  1260. end;
  1261. '<' : begin
  1262. readchar;
  1263. yylex:=_SHL;
  1264. goto exit_label;
  1265. end;
  1266. end;
  1267. yylex:=LT;
  1268. goto exit_label;
  1269. end;
  1270. #26 : begin
  1271. yylex:=_EOF;
  1272. goto exit_label;
  1273. end;
  1274. else
  1275. begin
  1276. Message(scan_f_illegal_char);
  1277. end;
  1278. end;
  1279. end;
  1280. exit_label:
  1281. end;
  1282. function tscannerfile.readpreproc:ttoken;
  1283. begin
  1284. skipspace;
  1285. case c of
  1286. 'A'..'Z',
  1287. 'a'..'z',
  1288. '_','0'..'9' : begin
  1289. preprocpat:=readid;
  1290. readpreproc:=ID;
  1291. end;
  1292. '(' : begin
  1293. readchar;
  1294. readpreproc:=LKLAMMER;
  1295. end;
  1296. ')' : begin
  1297. readchar;
  1298. readpreproc:=RKLAMMER;
  1299. end;
  1300. '+' : begin
  1301. readchar;
  1302. readpreproc:=PLUS;
  1303. end;
  1304. '-' : begin
  1305. readchar;
  1306. readpreproc:=MINUS;
  1307. end;
  1308. '*' : begin
  1309. readchar;
  1310. readpreproc:=STAR;
  1311. end;
  1312. '/' : begin
  1313. readchar;
  1314. readpreproc:=SLASH;
  1315. end;
  1316. '=' : begin
  1317. readchar;
  1318. readpreproc:=EQUAL;
  1319. end;
  1320. '>' : begin
  1321. readchar;
  1322. if c='=' then
  1323. begin
  1324. readchar;
  1325. readpreproc:=GTE;
  1326. end
  1327. else
  1328. readpreproc:=GT;
  1329. end;
  1330. '<' : begin
  1331. readchar;
  1332. case c of
  1333. '>' : begin
  1334. readchar;
  1335. readpreproc:=UNEQUAL;
  1336. end;
  1337. '=' : begin
  1338. readchar;
  1339. readpreproc:=LTE;
  1340. end;
  1341. else readpreproc:=LT;
  1342. end;
  1343. end;
  1344. #26 : Message(scan_f_end_of_file);
  1345. else
  1346. begin
  1347. readpreproc:=_EOF;
  1348. end;
  1349. end;
  1350. end;
  1351. function tscannerfile.asmgetchar : char;
  1352. begin
  1353. if lastasmgetchar<>#0 then
  1354. begin
  1355. c:=lastasmgetchar;
  1356. lastasmgetchar:=#0;
  1357. end
  1358. else
  1359. readchar;
  1360. case c of
  1361. '{' : begin
  1362. skipcomment;
  1363. lastasmgetchar:=c;
  1364. asmgetchar:=';';
  1365. exit;
  1366. end;
  1367. '/' : begin
  1368. readchar;
  1369. if c='/' then
  1370. begin
  1371. skipdelphicomment;
  1372. asmgetchar:=';';
  1373. end
  1374. else
  1375. asmgetchar:='/';
  1376. lastasmgetchar:=c;
  1377. exit;
  1378. end;
  1379. '(' : begin
  1380. readchar;
  1381. if c='*' then
  1382. begin
  1383. skipoldtpcomment;
  1384. asmgetchar:=';';
  1385. end
  1386. else
  1387. asmgetchar:='(';
  1388. lastasmgetchar:=c;
  1389. exit;
  1390. end;
  1391. else
  1392. begin
  1393. asmgetchar:=c;
  1394. end;
  1395. end;
  1396. end;
  1397. end.
  1398. {
  1399. $Log$
  1400. Revision 1.53 1998-09-24 23:49:20 peter
  1401. + aktmodeswitches
  1402. Revision 1.52 1998/09/18 16:03:45 florian
  1403. * some changes to compile with Delphi
  1404. Revision 1.51 1998/09/16 16:41:49 peter
  1405. * merged fixes
  1406. Revision 1.50.2.1 1998/09/16 16:09:49 peter
  1407. * on/off support also for the local/module switches
  1408. Revision 1.50 1998/09/04 08:36:06 peter
  1409. + (. and .) which are equal to [ and ]
  1410. Revision 1.49 1998/09/03 11:24:03 peter
  1411. * moved more inputfile things from tscannerfile to tinputfile
  1412. * changed ifdef Sourceline to cs_asm_source
  1413. Revision 1.48 1998/09/01 12:51:02 peter
  1414. * close also resets lastlinepos
  1415. Revision 1.47 1998/09/01 09:01:52 peter
  1416. * initialize all object variables in .init
  1417. Revision 1.46 1998/08/29 13:49:00 peter
  1418. * fixed freemem calls which had the wrong size sometimes
  1419. Revision 1.45 1998/08/26 15:35:35 peter
  1420. * fixed scannerfiles for macros
  1421. + $I %<environment>%
  1422. Revision 1.44 1998/08/20 16:09:55 pierre
  1423. * tokenpos has to be restored also after
  1424. printstatus
  1425. Revision 1.43 1998/08/20 09:26:45 pierre
  1426. + funcret setting in underproc testing
  1427. compile with _dTEST_FUNCRET
  1428. Revision 1.42 1998/08/19 14:57:51 peter
  1429. * small fix for aktfilepos
  1430. Revision 1.41 1998/08/18 14:17:10 pierre
  1431. * bug about assigning the return value of a function to
  1432. a procvar fixed : warning
  1433. assigning a proc to a procvar need @ in FPC mode !!
  1434. * missing file/line info restored
  1435. Revision 1.40 1998/08/11 14:04:33 peter
  1436. * auto close an open file and better error msg
  1437. Revision 1.39 1998/08/10 14:50:26 peter
  1438. + localswitches, moduleswitches, globalswitches splitting
  1439. Revision 1.38 1998/08/10 10:18:34 peter
  1440. + Compiler,Comphook unit which are the new interface units to the
  1441. compiler
  1442. Revision 1.37 1998/07/23 12:40:41 michael
  1443. No nested comments in Delphi mode.
  1444. Revision 1.36 1998/07/20 22:17:17 florian
  1445. * hex constants in numeric char (#$54#$43 ...) are now allowed
  1446. * there was a bug in record_var_dec which prevents the used
  1447. of nested variant records (for example drivers.tevent of tv)
  1448. Revision 1.35 1998/07/14 21:38:13 peter
  1449. + support for with p^do constructs
  1450. Revision 1.34 1998/07/14 14:47:04 peter
  1451. * released NEWINPUT
  1452. Revision 1.33 1998/07/10 10:48:40 peter
  1453. * fixed realnumber scanning
  1454. * [] after asmblock was not uppercased anymore
  1455. Revision 1.31 1998/07/07 17:39:38 peter
  1456. * fixed $I with following eof
  1457. Revision 1.30 1998/07/07 12:32:55 peter
  1458. * status.currentsource is now calculated in verbose (more accurated)
  1459. Revision 1.29 1998/07/07 11:20:11 peter
  1460. + NEWINPUT for a better inputfile and scanner object
  1461. Revision 1.28 1998/07/01 15:26:57 peter
  1462. * better bufferfile.reset error handling
  1463. Revision 1.27 1998/06/25 08:48:19 florian
  1464. * first version of rtti support
  1465. Revision 1.26 1998/06/16 08:56:30 peter
  1466. + targetcpu
  1467. * cleaner pmodules for newppu
  1468. Revision 1.25 1998/06/13 00:10:15 peter
  1469. * working browser and newppu
  1470. * some small fixes against crashes which occured in bp7 (but not in
  1471. fpc?!)
  1472. Revision 1.24 1998/06/12 10:32:36 pierre
  1473. * column problem hopefully solved
  1474. + C vars declaration changed
  1475. Revision 1.23 1998/06/03 22:49:02 peter
  1476. + wordbool,longbool
  1477. * rename bis,von -> high,low
  1478. * moved some systemunit loading/creating to psystem.pas
  1479. Revision 1.21 1998/05/27 00:20:32 peter
  1480. * some scanner optimizes
  1481. * automaticly aout2exe for go32v1
  1482. * fixed dynamiclinker option which was added at the wrong place
  1483. Revision 1.20 1998/05/23 01:21:30 peter
  1484. + aktasmmode, aktoptprocessor, aktoutputformat
  1485. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  1486. + $LIBNAME to set the library name where the unit will be put in
  1487. * splitted cgi386 a bit (codeseg to large for bp7)
  1488. * nasm, tasm works again. nasm moved to ag386nsm.pas
  1489. Revision 1.19 1998/05/20 09:42:37 pierre
  1490. + UseTokenInfo now default
  1491. * unit in interface uses and implementation uses gives error now
  1492. * only one error for unknown symbol (uses lastsymknown boolean)
  1493. the problem came from the label code !
  1494. + first inlined procedures and function work
  1495. (warning there might be allowed cases were the result is still wrong !!)
  1496. * UseBrower updated gives a global list of all position of all used symbols
  1497. with switch -gb
  1498. Revision 1.18 1998/05/12 10:47:00 peter
  1499. * moved printstatus to verb_def
  1500. + V_Normal which is between V_Error and V_Warning and doesn't have a
  1501. prefix like error: warning: and is included in V_Default
  1502. * fixed some messages
  1503. * first time parameter scan is only for -v and -T
  1504. - removed old style messages
  1505. Revision 1.17 1998/05/06 08:38:47 pierre
  1506. * better position info with UseTokenInfo
  1507. UseTokenInfo greatly simplified
  1508. + added check for changed tree after first time firstpass
  1509. (if we could remove all the cases were it happen
  1510. we could skip all firstpass if firstpasscount > 1)
  1511. Only with ExtDebug
  1512. Revision 1.16 1998/05/04 17:54:28 peter
  1513. + smartlinking works (only case jumptable left todo)
  1514. * redesign of systems.pas to support assemblers and linkers
  1515. + Unitname is now also in the PPU-file, increased version to 14
  1516. Revision 1.15 1998/05/01 16:38:46 florian
  1517. * handling of private and protected fixed
  1518. + change_keywords_to_tp implemented to remove
  1519. keywords which aren't supported by tp
  1520. * break and continue are now symbols of the system unit
  1521. + widestring, longstring and ansistring type released
  1522. Revision 1.14 1998/04/30 15:59:42 pierre
  1523. * GDB works again better :
  1524. correct type info in one pass
  1525. + UseTokenInfo for better source position
  1526. * fixed one remaining bug in scanner for line counts
  1527. * several little fixes
  1528. Revision 1.13 1998/04/29 13:42:27 peter
  1529. + $IOCHECKS and $ALIGN to test already, other will follow soon
  1530. * fixed the wrong linecounting with comments
  1531. Revision 1.12 1998/04/29 10:34:04 pierre
  1532. + added some code for ansistring (not complete nor working yet)
  1533. * corrected operator overloading
  1534. * corrected nasm output
  1535. + started inline procedures
  1536. + added starstarn : use ** for exponentiation (^ gave problems)
  1537. + started UseTokenInfo cond to get accurate positions
  1538. Revision 1.11 1998/04/27 23:10:29 peter
  1539. + new scanner
  1540. * $makelib -> if smartlink
  1541. * small filename fixes pmodule.setfilename
  1542. * moved import from files.pas -> import.pas
  1543. }