pstatmnt.pas 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 by Florian Klaempfl
  4. Does the parsing of the statements
  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 FPC}
  19. {$goto on}
  20. {$endif FPC}
  21. unit pstatmnt;
  22. interface
  23. uses tree;
  24. { reads a block }
  25. function block(islibrary : boolean) : ptree;
  26. { reads an assembler block }
  27. function assembler_block : ptree;
  28. implementation
  29. uses
  30. globtype,systems,tokens,
  31. strings,cutils,cobjects,globals,fmodule,verbose,cpuinfo,
  32. symconst,symtable,aasm,pass_1,types,scanner,
  33. {$ifdef newcg}
  34. cgbase,
  35. {$else}
  36. hcodegen,
  37. {$endif}
  38. ppu
  39. ,pbase,pexpr,pdecl,cpubase,cpuasm
  40. {$ifdef i386}
  41. ,tgeni386
  42. {$ifndef NoRa386Int}
  43. ,ra386int
  44. {$endif NoRa386Int}
  45. {$ifndef NoRa386Att}
  46. ,ra386att
  47. {$endif NoRa386Att}
  48. {$ifndef NoRa386Dir}
  49. ,ra386dir
  50. {$endif NoRa386Dir}
  51. {$endif i386}
  52. {$ifdef m68k}
  53. ,tgen68k
  54. {$ifndef NoRa68kMot}
  55. ,ra68kmot
  56. {$endif NoRa68kMot}
  57. {$endif m68k}
  58. {$ifdef alpha}
  59. ,tgeni386 { this is a dummy!! }
  60. {$endif alpha}
  61. {$ifdef powerpc}
  62. ,tgeni386 { this is a dummy!! }
  63. {$endif powerpc}
  64. ;
  65. const
  66. statement_level : longint = 0;
  67. function statement : ptree;forward;
  68. function if_statement : ptree;
  69. var
  70. ex,if_a,else_a : ptree;
  71. begin
  72. consume(_IF);
  73. ex:=comp_expr(true);
  74. consume(_THEN);
  75. if token<>_ELSE then
  76. if_a:=statement
  77. else
  78. if_a:=nil;
  79. if try_to_consume(_ELSE) then
  80. else_a:=statement
  81. else
  82. else_a:=nil;
  83. if_statement:=genloopnode(ifn,ex,if_a,else_a,false);
  84. end;
  85. { creates a block (list) of statements, til the next END token }
  86. function statements_til_end : ptree;
  87. var
  88. first,last : ptree;
  89. begin
  90. first:=nil;
  91. while token<>_END do
  92. begin
  93. if first=nil then
  94. begin
  95. last:=gennode(statementn,nil,statement);
  96. first:=last;
  97. end
  98. else
  99. begin
  100. last^.left:=gennode(statementn,nil,statement);
  101. last:=last^.left;
  102. end;
  103. if not try_to_consume(_SEMICOLON) then
  104. break;
  105. emptystats;
  106. end;
  107. consume(_END);
  108. statements_til_end:=gensinglenode(blockn,first);
  109. end;
  110. function case_statement : ptree;
  111. var
  112. { contains the label number of currently parsed case block }
  113. aktcaselabel : pasmlabel;
  114. firstlabel : boolean;
  115. root : pcaserecord;
  116. { the typ of the case expression }
  117. casedef : pdef;
  118. procedure newcaselabel(l,h : longint;first:boolean);
  119. var
  120. hcaselabel : pcaserecord;
  121. procedure insertlabel(var p : pcaserecord);
  122. begin
  123. if p=nil then p:=hcaselabel
  124. else
  125. if (p^._low>hcaselabel^._low) and
  126. (p^._low>hcaselabel^._high) then
  127. if (hcaselabel^.statement = p^.statement) and
  128. (p^._low = hcaselabel^._high + 1) then
  129. begin
  130. p^._low := hcaselabel^._low;
  131. dispose(hcaselabel);
  132. end
  133. else
  134. insertlabel(p^.less)
  135. else
  136. if (p^._high<hcaselabel^._low) and
  137. (p^._high<hcaselabel^._high) then
  138. if (hcaselabel^.statement = p^.statement) and
  139. (p^._high+1 = hcaselabel^._low) then
  140. begin
  141. p^._high := hcaselabel^._high;
  142. dispose(hcaselabel);
  143. end
  144. else
  145. insertlabel(p^.greater)
  146. else Message(parser_e_double_caselabel);
  147. end;
  148. begin
  149. new(hcaselabel);
  150. hcaselabel^.less:=nil;
  151. hcaselabel^.greater:=nil;
  152. hcaselabel^.statement:=aktcaselabel;
  153. hcaselabel^.firstlabel:=first;
  154. getlabel(hcaselabel^._at);
  155. hcaselabel^._low:=l;
  156. hcaselabel^._high:=h;
  157. insertlabel(root);
  158. end;
  159. var
  160. code,caseexpr,p,instruc,elseblock : ptree;
  161. hl1,hl2 : TConstExprInt;
  162. casedeferror : boolean;
  163. begin
  164. consume(_CASE);
  165. caseexpr:=comp_expr(true);
  166. { determines result type }
  167. cleartempgen;
  168. do_firstpass(caseexpr);
  169. casedeferror:=false;
  170. casedef:=caseexpr^.resulttype;
  171. if (not assigned(casedef)) or
  172. not(is_ordinal(casedef)) then
  173. begin
  174. CGMessage(type_e_ordinal_expr_expected);
  175. { create a correct tree }
  176. disposetree(caseexpr);
  177. caseexpr:=genordinalconstnode(0,u32bitdef);
  178. { set error flag so no rangechecks are done }
  179. casedeferror:=true;
  180. end;
  181. consume(_OF);
  182. inc(statement_level);
  183. root:=nil;
  184. instruc:=nil;
  185. repeat
  186. getlabel(aktcaselabel);
  187. firstlabel:=true;
  188. { may be an instruction has more case labels }
  189. repeat
  190. p:=expr;
  191. cleartempgen;
  192. do_firstpass(p);
  193. hl1:=0;
  194. hl2:=0;
  195. if (p^.treetype=rangen) then
  196. begin
  197. { type checking for case statements }
  198. if is_subequal(casedef, p^.left^.resulttype) and
  199. is_subequal(casedef, p^.right^.resulttype) then
  200. begin
  201. hl1:=get_ordinal_value(p^.left);
  202. hl2:=get_ordinal_value(p^.right);
  203. if hl1>hl2 then
  204. CGMessage(parser_e_case_lower_less_than_upper_bound);
  205. if not casedeferror then
  206. begin
  207. testrange(casedef,hl1);
  208. testrange(casedef,hl2);
  209. end;
  210. end
  211. else
  212. CGMessage(parser_e_case_mismatch);
  213. newcaselabel(hl1,hl2,firstlabel);
  214. end
  215. else
  216. begin
  217. { type checking for case statements }
  218. if not is_subequal(casedef, p^.resulttype) then
  219. CGMessage(parser_e_case_mismatch);
  220. hl1:=get_ordinal_value(p);
  221. if not casedeferror then
  222. testrange(casedef,hl1);
  223. newcaselabel(hl1,hl1,firstlabel);
  224. end;
  225. disposetree(p);
  226. if token=_COMMA then
  227. consume(_COMMA)
  228. else
  229. break;
  230. firstlabel:=false;
  231. until false;
  232. consume(_COLON);
  233. { handles instruction block }
  234. p:=gensinglenode(labeln,statement);
  235. p^.labelnr:=aktcaselabel;
  236. { concats instruction }
  237. instruc:=gennode(statementn,instruc,p);
  238. if not((token=_ELSE) or (token=_OTHERWISE) or (token=_END)) then
  239. consume(_SEMICOLON);
  240. until (token=_ELSE) or (token=_OTHERWISE) or (token=_END);
  241. if (token=_ELSE) or (token=_OTHERWISE) then
  242. begin
  243. if not try_to_consume(_ELSE) then
  244. consume(_OTHERWISE);
  245. elseblock:=statements_til_end;
  246. end
  247. else
  248. begin
  249. elseblock:=nil;
  250. consume(_END);
  251. end;
  252. dec(statement_level);
  253. code:=gencasenode(caseexpr,instruc,root);
  254. code^.elseblock:=elseblock;
  255. case_statement:=code;
  256. end;
  257. function repeat_statement : ptree;
  258. var
  259. first,last,p_e : ptree;
  260. begin
  261. consume(_REPEAT);
  262. first:=nil;
  263. inc(statement_level);
  264. while token<>_UNTIL do
  265. begin
  266. if first=nil then
  267. begin
  268. last:=gennode(statementn,nil,statement);
  269. first:=last;
  270. end
  271. else
  272. begin
  273. last^.left:=gennode(statementn,nil,statement);
  274. last:=last^.left;
  275. end;
  276. if not try_to_consume(_SEMICOLON) then
  277. break;
  278. emptystats;
  279. end;
  280. consume(_UNTIL);
  281. dec(statement_level);
  282. first:=gensinglenode(blockn,first);
  283. p_e:=comp_expr(true);
  284. repeat_statement:=genloopnode(repeatn,p_e,first,nil,false);
  285. end;
  286. function while_statement : ptree;
  287. var
  288. p_e,p_a : ptree;
  289. begin
  290. consume(_WHILE);
  291. p_e:=comp_expr(true);
  292. consume(_DO);
  293. p_a:=statement;
  294. while_statement:=genloopnode(whilen,p_e,p_a,nil,false);
  295. end;
  296. function for_statement : ptree;
  297. var
  298. p_e,tovalue,p_a : ptree;
  299. backward : boolean;
  300. begin
  301. { parse loop header }
  302. consume(_FOR);
  303. p_e:=expr;
  304. if token=_DOWNTO then
  305. begin
  306. consume(_DOWNTO);
  307. backward:=true;
  308. end
  309. else
  310. begin
  311. consume(_TO);
  312. backward:=false;
  313. end;
  314. tovalue:=comp_expr(true);
  315. consume(_DO);
  316. { ... now the instruction }
  317. p_a:=statement;
  318. for_statement:=genloopnode(forn,p_e,tovalue,p_a,backward);
  319. end;
  320. function _with_statement : ptree;
  321. var
  322. right,p : ptree;
  323. i,levelcount : longint;
  324. withsymtable,symtab : psymtable;
  325. obj : pobjectdef;
  326. {$ifdef tp}
  327. hp : ptree;
  328. {$endif}
  329. begin
  330. p:=comp_expr(true);
  331. do_firstpass(p);
  332. set_varstate(p,false);
  333. right:=nil;
  334. if (not codegenerror) and
  335. (p^.resulttype^.deftype in [objectdef,recorddef]) then
  336. begin
  337. case p^.resulttype^.deftype of
  338. objectdef : begin
  339. obj:=pobjectdef(p^.resulttype);
  340. withsymtable:=new(pwithsymtable,init);
  341. withsymtable^.symsearch:=obj^.symtable^.symsearch;
  342. withsymtable^.defowner:=obj;
  343. symtab:=withsymtable;
  344. if (p^.treetype=loadn) and
  345. (p^.symtable=aktprocsym^.definition^.localst) then
  346. pwithsymtable(symtab)^.direct_with:=true;
  347. {symtab^.withnode:=p; not yet allocated !! }
  348. pwithsymtable(symtab)^.withrefnode:=p;
  349. levelcount:=1;
  350. obj:=obj^.childof;
  351. while assigned(obj) do
  352. begin
  353. symtab^.next:=new(pwithsymtable,init);
  354. symtab:=symtab^.next;
  355. symtab^.symsearch:=obj^.symtable^.symsearch;
  356. if (p^.treetype=loadn) and
  357. (p^.symtable=aktprocsym^.definition^.localst) then
  358. pwithsymtable(symtab)^.direct_with:=true;
  359. {symtab^.withnode:=p; not yet allocated !! }
  360. pwithsymtable(symtab)^.withrefnode:=p;
  361. symtab^.defowner:=obj;
  362. obj:=obj^.childof;
  363. inc(levelcount);
  364. end;
  365. symtab^.next:=symtablestack;
  366. symtablestack:=withsymtable;
  367. end;
  368. recorddef : begin
  369. symtab:=precorddef(p^.resulttype)^.symtable;
  370. levelcount:=1;
  371. withsymtable:=new(pwithsymtable,init);
  372. withsymtable^.symsearch:=symtab^.symsearch;
  373. withsymtable^.next:=symtablestack;
  374. if (p^.treetype=loadn) and
  375. (p^.symtable=aktprocsym^.definition^.localst) then
  376. pwithsymtable(withsymtable)^.direct_with:=true;
  377. {symtab^.withnode:=p; not yet allocated !! }
  378. pwithsymtable(withsymtable)^.withrefnode:=p;
  379. withsymtable^.defowner:=precorddef(p^.resulttype);
  380. symtablestack:=withsymtable;
  381. end;
  382. end;
  383. if token=_COMMA then
  384. begin
  385. consume(_COMMA);
  386. right:=_with_statement{$ifndef tp}(){$endif};
  387. end
  388. else
  389. begin
  390. consume(_DO);
  391. if token<>_SEMICOLON then
  392. right:=statement
  393. else
  394. right:=nil;
  395. end;
  396. for i:=1 to levelcount do
  397. symtablestack:=symtablestack^.next;
  398. _with_statement:=genwithnode(pwithsymtable(withsymtable),p,right,levelcount);
  399. end
  400. else
  401. begin
  402. Message(parser_e_false_with_expr);
  403. { try to recover from error }
  404. if token=_COMMA then
  405. begin
  406. consume(_COMMA);
  407. {$ifdef tp}
  408. hp:=_with_statement;
  409. {$else}
  410. _with_statement();
  411. {$endif}
  412. end
  413. else
  414. begin
  415. consume(_DO);
  416. { ignore all }
  417. if token<>_SEMICOLON then
  418. statement;
  419. end;
  420. _with_statement:=nil;
  421. end;
  422. end;
  423. function with_statement : ptree;
  424. begin
  425. consume(_WITH);
  426. with_statement:=_with_statement;
  427. end;
  428. function raise_statement : ptree;
  429. var
  430. p,pobj,paddr,pframe : ptree;
  431. begin
  432. pobj:=nil;
  433. paddr:=nil;
  434. pframe:=nil;
  435. consume(_RAISE);
  436. if not(token in [_SEMICOLON,_END]) then
  437. begin
  438. { object }
  439. pobj:=comp_expr(true);
  440. if try_to_consume(_AT) then
  441. begin
  442. paddr:=comp_expr(true);
  443. if try_to_consume(_COMMA) then
  444. pframe:=comp_expr(true);
  445. end;
  446. end
  447. else
  448. begin
  449. if (block_type<>bt_except) then
  450. Message(parser_e_no_reraise_possible);
  451. end;
  452. p:=gennode(raisen,pobj,paddr);
  453. p^.frametree:=pframe;
  454. raise_statement:=p;
  455. end;
  456. function try_statement : ptree;
  457. var
  458. p_try_block,p_finally_block,first,last,
  459. p_default,p_specific,hp : ptree;
  460. ot : pobjectdef;
  461. sym : pvarsym;
  462. old_block_type : tblock_type;
  463. exceptsymtable : psymtable;
  464. objname : stringid;
  465. begin
  466. procinfo^.flags:=procinfo^.flags or
  467. pi_uses_exceptions;
  468. p_default:=nil;
  469. p_specific:=nil;
  470. { read statements to try }
  471. consume(_TRY);
  472. first:=nil;
  473. inc(statement_level);
  474. while (token<>_FINALLY) and (token<>_EXCEPT) do
  475. begin
  476. if first=nil then
  477. begin
  478. last:=gennode(statementn,nil,statement);
  479. first:=last;
  480. end
  481. else
  482. begin
  483. last^.left:=gennode(statementn,nil,statement);
  484. last:=last^.left;
  485. end;
  486. if not try_to_consume(_SEMICOLON) then
  487. break;
  488. emptystats;
  489. end;
  490. p_try_block:=gensinglenode(blockn,first);
  491. if try_to_consume(_FINALLY) then
  492. begin
  493. p_finally_block:=statements_til_end;
  494. try_statement:=gennode(tryfinallyn,p_try_block,p_finally_block);
  495. dec(statement_level);
  496. end
  497. else
  498. begin
  499. consume(_EXCEPT);
  500. old_block_type:=block_type;
  501. block_type:=bt_except;
  502. p_specific:=nil;
  503. if token=_ON then
  504. { catch specific exceptions }
  505. begin
  506. repeat
  507. consume(_ON);
  508. if token=_ID then
  509. begin
  510. objname:=pattern;
  511. getsym(objname,false);
  512. consume(_ID);
  513. { is a explicit name for the exception given ? }
  514. if try_to_consume(_COLON) then
  515. begin
  516. getsym(pattern,true);
  517. consume(_ID);
  518. if srsym^.typ=unitsym then
  519. begin
  520. consume(_POINT);
  521. getsymonlyin(punitsym(srsym)^.unitsymtable,pattern);
  522. consume(_ID);
  523. end;
  524. if (srsym^.typ=typesym) and
  525. (ptypesym(srsym)^.restype.def^.deftype=objectdef) and
  526. pobjectdef(ptypesym(srsym)^.restype.def)^.is_class then
  527. begin
  528. ot:=pobjectdef(ptypesym(srsym)^.restype.def);
  529. sym:=new(pvarsym,initdef(objname,ot));
  530. end
  531. else
  532. begin
  533. sym:=new(pvarsym,initdef(objname,new(perrordef,init)));
  534. if (srsym^.typ=typesym) then
  535. Message1(type_e_class_type_expected,ptypesym(srsym)^.restype.def^.typename)
  536. else
  537. Message1(type_e_class_type_expected,ot^.typename);
  538. end;
  539. exceptsymtable:=new(psymtable,init(stt_exceptsymtable));
  540. exceptsymtable^.insert(sym);
  541. { insert the exception symtable stack }
  542. exceptsymtable^.next:=symtablestack;
  543. symtablestack:=exceptsymtable;
  544. end
  545. else
  546. begin
  547. { check if type is valid, must be done here because
  548. with "e: Exception" the e is not necessary }
  549. if srsym=nil then
  550. begin
  551. Message1(sym_e_id_not_found,objname);
  552. srsym:=generrorsym;
  553. end;
  554. { only exception type }
  555. if srsym^.typ=unitsym then
  556. begin
  557. consume(_POINT);
  558. getsymonlyin(punitsym(srsym)^.unitsymtable,pattern);
  559. consume(_ID);
  560. end;
  561. if (srsym^.typ=typesym) and
  562. (ptypesym(srsym)^.restype.def^.deftype=objectdef) and
  563. pobjectdef(ptypesym(srsym)^.restype.def)^.is_class then
  564. ot:=pobjectdef(ptypesym(srsym)^.restype.def)
  565. else
  566. begin
  567. ot:=pobjectdef(generrordef);
  568. if (srsym^.typ=typesym) then
  569. Message1(type_e_class_type_expected,ptypesym(srsym)^.restype.def^.typename)
  570. else
  571. Message1(type_e_class_type_expected,ot^.typename);
  572. end;
  573. exceptsymtable:=nil;
  574. end;
  575. end
  576. else
  577. consume(_ID);
  578. consume(_DO);
  579. hp:=gennode(onn,nil,statement);
  580. if ot^.deftype=errordef then
  581. begin
  582. disposetree(hp);
  583. hp:=genzeronode(errorn);
  584. end;
  585. if p_specific=nil then
  586. begin
  587. last:=hp;
  588. p_specific:=last;
  589. end
  590. else
  591. begin
  592. last^.left:=hp;
  593. last:=last^.left;
  594. end;
  595. { set the informations }
  596. last^.excepttype:=ot;
  597. last^.exceptsymtable:=exceptsymtable;
  598. last^.disposetyp:=dt_onn;
  599. { remove exception symtable }
  600. if assigned(exceptsymtable) then
  601. dellexlevel;
  602. if not try_to_consume(_SEMICOLON) then
  603. break;
  604. emptystats;
  605. until (token=_END) or(token=_ELSE);
  606. if token=_ELSE then
  607. { catch the other exceptions }
  608. begin
  609. consume(_ELSE);
  610. p_default:=statements_til_end;
  611. end
  612. else
  613. consume(_END);
  614. end
  615. else
  616. { catch all exceptions }
  617. begin
  618. p_default:=statements_til_end;
  619. end;
  620. dec(statement_level);
  621. block_type:=old_block_type;
  622. try_statement:=genloopnode(tryexceptn,p_try_block,p_specific,p_default,false);
  623. end;
  624. end;
  625. function exit_statement : ptree;
  626. var
  627. p : ptree;
  628. begin
  629. consume(_EXIT);
  630. if try_to_consume(_LKLAMMER) then
  631. begin
  632. p:=comp_expr(true);
  633. consume(_RKLAMMER);
  634. if (block_type=bt_except) then
  635. Message(parser_e_exit_with_argument_not__possible);
  636. if procinfo^.returntype.def=pdef(voiddef) then
  637. Message(parser_e_void_function);
  638. end
  639. else
  640. p:=nil;
  641. p:=gensinglenode(exitn,p);
  642. // p^.resulttype:=procinfo^.returntype.def;
  643. p^.resulttype:=voiddef;
  644. exit_statement:=p;
  645. end;
  646. function _asm_statement : ptree;
  647. var
  648. asmstat : ptree;
  649. Marker : Pai;
  650. begin
  651. Inside_asm_statement:=true;
  652. case aktasmmode of
  653. asmmode_none : ; { just be there to allow to a compile without
  654. any assembler readers }
  655. {$ifdef i386}
  656. {$ifndef NoRA386Att}
  657. asmmode_i386_att:
  658. asmstat:=ra386att.assemble;
  659. {$endif NoRA386Att}
  660. {$ifndef NoRA386Int}
  661. asmmode_i386_intel:
  662. asmstat:=ra386int.assemble;
  663. {$endif NoRA386Int}
  664. {$ifndef NoRA386Dir}
  665. asmmode_i386_direct:
  666. begin
  667. if not target_asm.allowdirect then
  668. Message(parser_f_direct_assembler_not_allowed);
  669. if (pocall_inline in aktprocsym^.definition^.proccalloptions) then
  670. Begin
  671. Message1(parser_w_not_supported_for_inline,'direct asm');
  672. Message(parser_w_inlining_disabled);
  673. exclude(aktprocsym^.definition^.proccalloptions,pocall_inline);
  674. End;
  675. asmstat:=ra386dir.assemble;
  676. end;
  677. {$endif NoRA386Dir}
  678. {$endif}
  679. {$ifdef m68k}
  680. {$ifndef NoRA68kMot}
  681. asmmode_m68k_mot:
  682. asmstat:=ra68kmot.assemble;
  683. {$endif NoRA68kMot}
  684. {$endif}
  685. else
  686. Message(parser_f_assembler_reader_not_supported);
  687. end;
  688. { Read first the _ASM statement }
  689. consume(_ASM);
  690. {$ifndef newcg}
  691. { END is read }
  692. if try_to_consume(_LECKKLAMMER) then
  693. begin
  694. { it's possible to specify the modified registers }
  695. asmstat^.object_preserved:=true;
  696. if token<>_RECKKLAMMER then
  697. repeat
  698. { uppercase, because it's a CSTRING }
  699. uppervar(pattern);
  700. {$ifdef i386}
  701. if pattern='EAX' then
  702. usedinproc:=usedinproc or ($80 shr byte(R_EAX))
  703. else if pattern='EBX' then
  704. usedinproc:=usedinproc or ($80 shr byte(R_EBX))
  705. else if pattern='ECX' then
  706. usedinproc:=usedinproc or ($80 shr byte(R_ECX))
  707. else if pattern='EDX' then
  708. usedinproc:=usedinproc or ($80 shr byte(R_EDX))
  709. else if pattern='ESI' then
  710. begin
  711. usedinproc:=usedinproc or ($80 shr byte(R_ESI));
  712. asmstat^.object_preserved:=false;
  713. end
  714. else if pattern='EDI' then
  715. usedinproc:=usedinproc or ($80 shr byte(R_EDI))
  716. {$endif i386}
  717. {$ifdef m68k}
  718. if pattern='D0' then
  719. usedinproc:=usedinproc or ($800 shr word(R_D0))
  720. else if pattern='D1' then
  721. usedinproc:=usedinproc or ($800 shr word(R_D1))
  722. else if pattern='D6' then
  723. usedinproc:=usedinproc or ($800 shr word(R_D6))
  724. else if pattern='A0' then
  725. usedinproc:=usedinproc or ($800 shr word(R_A0))
  726. else if pattern='A1' then
  727. usedinproc:=usedinproc or ($800 shr word(R_A1))
  728. {$endif m68k}
  729. else consume(_RECKKLAMMER);
  730. consume(_CSTRING);
  731. if not try_to_consume(_COMMA) then
  732. break;
  733. until false;
  734. consume(_RECKKLAMMER);
  735. end
  736. else usedinproc:=$ff;
  737. {$endif newcg}
  738. { mark the start and the end of the assembler block for the optimizer }
  739. If Assigned(AsmStat^.p_asm) Then
  740. Begin
  741. Marker := New(Pai_Marker, Init(AsmBlockStart));
  742. AsmStat^.p_asm^.Insert(Marker);
  743. Marker := New(Pai_Marker, Init(AsmBlockEnd));
  744. AsmStat^.p_asm^.Concat(Marker);
  745. End;
  746. Inside_asm_statement:=false;
  747. _asm_statement:=asmstat;
  748. end;
  749. function new_dispose_statement : ptree;
  750. var
  751. p,p2 : ptree;
  752. ht : ttoken;
  753. again : boolean; { dummy for do_proc_call }
  754. destructorname : stringid;
  755. sym : psym;
  756. classh : pobjectdef;
  757. pd,pd2 : pdef;
  758. destructorpos,storepos : tfileposinfo;
  759. tt : ttreetyp;
  760. begin
  761. ht:=token;
  762. if try_to_consume(_NEW) then
  763. tt:=hnewn
  764. else
  765. begin
  766. consume(_DISPOSE);
  767. tt:=hdisposen;
  768. end;
  769. consume(_LKLAMMER);
  770. p:=comp_expr(true);
  771. { calc return type }
  772. cleartempgen;
  773. do_firstpass(p);
  774. set_varstate(p,tt=hdisposen);
  775. {var o:Pobject;
  776. begin
  777. new(o,init); (*Also a valid new statement*)
  778. end;}
  779. if try_to_consume(_COMMA) then
  780. begin
  781. { extended syntax of new and dispose }
  782. { function styled new is handled in factor }
  783. { destructors have no parameters }
  784. destructorname:=pattern;
  785. destructorpos:=tokenpos;
  786. consume(_ID);
  787. pd:=p^.resulttype;
  788. if pd=nil then
  789. pd:=generrordef;
  790. pd2:=pd;
  791. if (pd^.deftype<>pointerdef) then
  792. begin
  793. Message1(type_e_pointer_type_expected,pd^.typename);
  794. p:=factor(false);
  795. consume(_RKLAMMER);
  796. new_dispose_statement:=genzeronode(errorn);
  797. exit;
  798. end;
  799. { first parameter must be an object or class }
  800. if ppointerdef(pd)^.pointertype.def^.deftype<>objectdef then
  801. begin
  802. Message(parser_e_pointer_to_class_expected);
  803. new_dispose_statement:=factor(false);
  804. consume_all_until(_RKLAMMER);
  805. consume(_RKLAMMER);
  806. exit;
  807. end;
  808. { check, if the first parameter is a pointer to a _class_ }
  809. classh:=pobjectdef(ppointerdef(pd)^.pointertype.def);
  810. if classh^.is_class then
  811. begin
  812. Message(parser_e_no_new_or_dispose_for_classes);
  813. new_dispose_statement:=factor(false);
  814. consume_all_until(_RKLAMMER);
  815. consume(_RKLAMMER);
  816. exit;
  817. end;
  818. { search cons-/destructor, also in parent classes }
  819. storepos:=tokenpos;
  820. tokenpos:=destructorpos;
  821. sym:=search_class_member(classh,destructorname);
  822. tokenpos:=storepos;
  823. { the second parameter of new/dispose must be a call }
  824. { to a cons-/destructor }
  825. if (not assigned(sym)) or (sym^.typ<>procsym) then
  826. begin
  827. if tt=hnewn then
  828. Message(parser_e_expr_have_to_be_constructor_call)
  829. else
  830. Message(parser_e_expr_have_to_be_destructor_call);
  831. new_dispose_statement:=genzeronode(errorn);
  832. end
  833. else
  834. begin
  835. p2:=gensinglenode(tt,p);
  836. if ht=_NEW then
  837. begin
  838. { Constructors can take parameters.}
  839. p2^.resulttype:=ppointerdef(pd)^.pointertype.def;
  840. do_member_read(false,sym,p2,pd,again);
  841. end
  842. else
  843. begin
  844. if (m_tp in aktmodeswitches) then
  845. begin
  846. { Constructors can take parameters.}
  847. p2^.resulttype:=ppointerdef(pd)^.pointertype.def;
  848. do_member_read(false,sym,p2,pd,again);
  849. end
  850. else
  851. begin
  852. p2:=genmethodcallnode(pprocsym(sym),srsymtable,p2);
  853. { support dispose(p,done()); }
  854. if try_to_consume(_LKLAMMER) then
  855. begin
  856. if not try_to_consume(_RKLAMMER) then
  857. begin
  858. Message(parser_e_no_paras_for_destructor);
  859. consume_all_until(_RKLAMMER);
  860. consume(_RKLAMMER);
  861. end;
  862. end;
  863. end;
  864. end;
  865. { we need the real called method }
  866. cleartempgen;
  867. do_firstpass(p2);
  868. if not codegenerror then
  869. begin
  870. if (ht=_NEW) and (p2^.procdefinition^.proctypeoption<>potype_constructor) then
  871. Message(parser_e_expr_have_to_be_constructor_call);
  872. if (ht=_DISPOSE) and (p2^.procdefinition^.proctypeoption<>potype_destructor) then
  873. Message(parser_e_expr_have_to_be_destructor_call);
  874. if ht=_NEW then
  875. begin
  876. p2:=gennode(assignn,getcopy(p),gensinglenode(newn,p2));
  877. p2^.right^.resulttype:=pd2;
  878. end;
  879. end;
  880. new_dispose_statement:=p2;
  881. end;
  882. end
  883. else
  884. begin
  885. if p^.resulttype=nil then
  886. p^.resulttype:=generrordef;
  887. if (p^.resulttype^.deftype<>pointerdef) then
  888. Begin
  889. Message1(type_e_pointer_type_expected,p^.resulttype^.typename);
  890. new_dispose_statement:=genzeronode(errorn);
  891. end
  892. else
  893. begin
  894. if (ppointerdef(p^.resulttype)^.pointertype.def^.deftype=objectdef) and
  895. (oo_has_vmt in pobjectdef(ppointerdef(p^.resulttype)^.pointertype.def)^.objectoptions) then
  896. Message(parser_w_use_extended_syntax_for_objects);
  897. if (ppointerdef(p^.resulttype)^.pointertype.def^.deftype=orddef) and
  898. (porddef(ppointerdef(p^.resulttype)^.pointertype.def)^.typ=uvoid) then
  899. if (m_tp in aktmodeswitches) or
  900. (m_delphi in aktmodeswitches) then
  901. Message(parser_w_no_new_dispose_on_void_pointers)
  902. else
  903. Message(parser_e_no_new_dispose_on_void_pointers);
  904. case ht of
  905. _NEW : new_dispose_statement:=gensinglenode(simplenewn,p);
  906. _DISPOSE : new_dispose_statement:=gensinglenode(simpledisposen,p);
  907. end;
  908. end;
  909. end;
  910. consume(_RKLAMMER);
  911. end;
  912. function statement_block(starttoken : ttoken) : ptree;
  913. var
  914. first,last : ptree;
  915. filepos : tfileposinfo;
  916. begin
  917. first:=nil;
  918. filepos:=tokenpos;
  919. consume(starttoken);
  920. inc(statement_level);
  921. while not(token in [_END,_FINALIZATION]) do
  922. begin
  923. if first=nil then
  924. begin
  925. last:=gennode(statementn,nil,statement);
  926. first:=last;
  927. end
  928. else
  929. begin
  930. last^.left:=gennode(statementn,nil,statement);
  931. last:=last^.left;
  932. end;
  933. if (token in [_END,_FINALIZATION]) then
  934. break
  935. else
  936. begin
  937. { if no semicolon, then error and go on }
  938. if token<>_SEMICOLON then
  939. begin
  940. consume(_SEMICOLON);
  941. consume_all_until(_SEMICOLON);
  942. end;
  943. consume(_SEMICOLON);
  944. end;
  945. emptystats;
  946. end;
  947. { don't consume the finalization token, it is consumed when
  948. reading the finalization block, but allow it only after
  949. an initalization ! }
  950. if (starttoken<>_INITIALIZATION) or (token<>_FINALIZATION) then
  951. consume(_END);
  952. dec(statement_level);
  953. last:=gensinglenode(blockn,first);
  954. set_tree_filepos(last,filepos);
  955. statement_block:=last;
  956. end;
  957. function statement : ptree;
  958. var
  959. p : ptree;
  960. code : ptree;
  961. labelnr : pasmlabel;
  962. filepos : tfileposinfo;
  963. sr : plabelsym;
  964. label
  965. ready;
  966. begin
  967. filepos:=tokenpos;
  968. case token of
  969. _GOTO : begin
  970. if not(cs_support_goto in aktmoduleswitches)then
  971. Message(sym_e_goto_and_label_not_supported);
  972. consume(_GOTO);
  973. if (token<>_INTCONST) and (token<>_ID) then
  974. begin
  975. Message(sym_e_label_not_found);
  976. code:=genzeronode(errorn);
  977. end
  978. else
  979. begin
  980. getsym(pattern,true);
  981. consume(token);
  982. if srsym^.typ<>labelsym then
  983. begin
  984. Message(sym_e_id_is_no_label_id);
  985. code:=genzeronode(errorn);
  986. end
  987. else
  988. begin
  989. code:=genlabelnode(goton,plabelsym(srsym)^.lab);
  990. code^.labsym:=plabelsym(srsym);
  991. { set flag that this label is used }
  992. plabelsym(srsym)^.used:=true;
  993. end;
  994. end;
  995. end;
  996. _BEGIN : code:=statement_block(_BEGIN);
  997. _IF : code:=if_statement;
  998. _CASE : code:=case_statement;
  999. _REPEAT : code:=repeat_statement;
  1000. _WHILE : code:=while_statement;
  1001. _FOR : code:=for_statement;
  1002. _NEW,_DISPOSE : code:=new_dispose_statement;
  1003. _WITH : code:=with_statement;
  1004. _TRY : code:=try_statement;
  1005. _RAISE : code:=raise_statement;
  1006. { semicolons,else until and end are ignored }
  1007. _SEMICOLON,
  1008. _ELSE,
  1009. _UNTIL,
  1010. _END:
  1011. code:=genzeronode(niln);
  1012. _FAIL : begin
  1013. { internalerror(100); }
  1014. if (aktprocsym^.definition^.proctypeoption<>potype_constructor) then
  1015. Message(parser_e_fail_only_in_constructor);
  1016. consume(_FAIL);
  1017. code:=genzeronode(failn);
  1018. end;
  1019. _EXIT : code:=exit_statement;
  1020. _ASM : begin
  1021. code:=_asm_statement;
  1022. end;
  1023. _EOF : begin
  1024. Message(scan_f_end_of_file);
  1025. end;
  1026. else
  1027. begin
  1028. if (token in [_INTCONST,_ID]) then
  1029. begin
  1030. getsym(pattern,true);
  1031. lastsymknown:=true;
  1032. lastsrsym:=srsym;
  1033. { it is NOT necessarily the owner
  1034. it can be a withsymtable !!! }
  1035. lastsrsymtable:=srsymtable;
  1036. if assigned(srsym) and (srsym^.typ=labelsym) then
  1037. begin
  1038. consume(token);
  1039. consume(_COLON);
  1040. { we must preserve srsym to set code later }
  1041. sr:=plabelsym(srsym);
  1042. if sr^.defined then
  1043. Message(sym_e_label_already_defined);
  1044. sr^.defined:=true;
  1045. { statement modifies srsym }
  1046. labelnr:=sr^.lab;
  1047. lastsymknown:=false;
  1048. { the pointer to the following instruction }
  1049. { isn't a very clean way }
  1050. code:=gensinglenode(labeln,statement{$ifndef tp}(){$endif});
  1051. code^.labelnr:=labelnr;
  1052. sr^.code:=code;
  1053. { sorry, but there is a jump the easiest way }
  1054. goto ready;
  1055. end;
  1056. end;
  1057. p:=expr;
  1058. if not(p^.treetype in [calln,assignn,breakn,inlinen,
  1059. continuen]) then
  1060. Message(cg_e_illegal_expression);
  1061. { specify that we don't use the value returned by the call }
  1062. { Question : can this be also improtant
  1063. for inlinen ??
  1064. it is used for :
  1065. - dispose of temp stack space
  1066. - dispose on FPU stack }
  1067. if p^.treetype=calln then
  1068. p^.return_value_used:=false;
  1069. code:=p;
  1070. end;
  1071. end;
  1072. ready:
  1073. if assigned(code) then
  1074. set_tree_filepos(code,filepos);
  1075. statement:=code;
  1076. end;
  1077. function block(islibrary : boolean) : ptree;
  1078. var
  1079. funcretsym : pfuncretsym;
  1080. storepos : tfileposinfo;
  1081. begin
  1082. { do we have an assembler block without the po_assembler?
  1083. we should allow this for Delphi compatibility (PFV) }
  1084. if (token=_ASM) and (m_delphi in aktmodeswitches) then
  1085. begin
  1086. include(aktprocsym^.definition^.procoptions,po_assembler);
  1087. block:=assembler_block;
  1088. exit;
  1089. end;
  1090. if procinfo^.returntype.def<>pdef(voiddef) then
  1091. begin
  1092. { if the current is a function aktprocsym is non nil }
  1093. { and there is a local symtable set }
  1094. storepos:=tokenpos;
  1095. tokenpos:=aktprocsym^.fileinfo;
  1096. funcretsym:=new(pfuncretsym,init(aktprocsym^.name,procinfo));
  1097. { insert in local symtable }
  1098. symtablestack^.insert(funcretsym);
  1099. tokenpos:=storepos;
  1100. if ret_in_acc(procinfo^.returntype.def) or (procinfo^.returntype.def^.deftype=floatdef) then
  1101. procinfo^.return_offset:=-funcretsym^.address;
  1102. procinfo^.funcretsym:=funcretsym;
  1103. { insert result also if support is on }
  1104. if (m_result in aktmodeswitches) then
  1105. begin
  1106. procinfo^.resultfuncretsym:=new(pfuncretsym,init('RESULT',procinfo));
  1107. symtablestack^.insert(procinfo^.resultfuncretsym);
  1108. end;
  1109. end;
  1110. read_declarations(islibrary);
  1111. { temporary space is set, while the BEGIN of the procedure }
  1112. if (symtablestack^.symtabletype=localsymtable) then
  1113. procinfo^.firsttemp_offset := -symtablestack^.datasize
  1114. else
  1115. procinfo^.firsttemp_offset := 0;
  1116. { space for the return value }
  1117. { !!!!! this means that we can not set the return value
  1118. in a subfunction !!!!! }
  1119. { because we don't know yet where the address is }
  1120. if procinfo^.returntype.def<>pdef(voiddef) then
  1121. begin
  1122. if ret_in_acc(procinfo^.returntype.def) or (procinfo^.returntype.def^.deftype=floatdef) then
  1123. { if (procinfo^.retdef^.deftype=orddef) or
  1124. (procinfo^.retdef^.deftype=pointerdef) or
  1125. (procinfo^.retdef^.deftype=enumdef) or
  1126. (procinfo^.retdef^.deftype=procvardef) or
  1127. (procinfo^.retdef^.deftype=floatdef) or
  1128. (
  1129. (procinfo^.retdef^.deftype=setdef) and
  1130. (psetdef(procinfo^.retdef)^.settype=smallset)
  1131. ) then }
  1132. begin
  1133. { the space has been set in the local symtable }
  1134. procinfo^.return_offset:=-funcretsym^.address;
  1135. if ((procinfo^.flags and pi_operator)<>0) and
  1136. assigned(opsym) then
  1137. {opsym^.address:=procinfo^.para_offset; is wrong PM }
  1138. opsym^.address:=-procinfo^.return_offset;
  1139. { eax is modified by a function }
  1140. {$ifndef newcg}
  1141. {$ifdef i386}
  1142. usedinproc:=usedinproc or ($80 shr byte(R_EAX));
  1143. if is_64bitint(procinfo^.returntype.def) then
  1144. usedinproc:=usedinproc or ($80 shr byte(R_EDX))
  1145. {$endif}
  1146. {$ifdef m68k}
  1147. usedinproc:=usedinproc or ($800 shr word(R_D0));
  1148. if is_64bitint(procinfo^.retdef) then
  1149. usedinproc:=usedinproc or ($800 shr byte(R_D1))
  1150. {$endif}
  1151. {$endif newcg}
  1152. end;
  1153. end;
  1154. {Unit initialization?.}
  1155. if (lexlevel=unit_init_level) and (current_module^.is_unit)
  1156. or islibrary then
  1157. begin
  1158. if (token=_END) then
  1159. begin
  1160. consume(_END);
  1161. { We need at least a node, else the entry/exit code is not
  1162. generated and thus no PASCALMAIN symbol which we need (PFV) }
  1163. if islibrary then
  1164. block:=genzeronode(nothingn)
  1165. else
  1166. block:=nil;
  1167. end
  1168. else
  1169. begin
  1170. if token=_INITIALIZATION then
  1171. begin
  1172. current_module^.flags:=current_module^.flags or uf_init;
  1173. block:=statement_block(_INITIALIZATION);
  1174. end
  1175. else if (token=_FINALIZATION) then
  1176. begin
  1177. if (current_module^.flags and uf_finalize)<>0 then
  1178. block:=statement_block(_FINALIZATION)
  1179. else
  1180. begin
  1181. { can we allow no INITIALIZATION for DLL ??
  1182. I think it should work PM }
  1183. block:=nil;
  1184. exit;
  1185. end;
  1186. end
  1187. else
  1188. begin
  1189. current_module^.flags:=current_module^.flags or uf_init;
  1190. block:=statement_block(_BEGIN);
  1191. end;
  1192. end;
  1193. end
  1194. else
  1195. block:=statement_block(_BEGIN);
  1196. end;
  1197. function assembler_block : ptree;
  1198. begin
  1199. read_declarations(false);
  1200. { temporary space is set, while the BEGIN of the procedure }
  1201. if symtablestack^.symtabletype=localsymtable then
  1202. procinfo^.firsttemp_offset := -symtablestack^.datasize
  1203. else
  1204. procinfo^.firsttemp_offset := 0;
  1205. { assembler code does not allocate }
  1206. { space for the return value }
  1207. if procinfo^.returntype.def<>pdef(voiddef) then
  1208. begin
  1209. if ret_in_acc(procinfo^.returntype.def) then
  1210. begin
  1211. { in assembler code the result should be directly in %eax
  1212. procinfo^.retoffset:=procinfo^.firsttemp-procinfo^.retdef^.size;
  1213. procinfo^.firsttemp:=procinfo^.retoffset; }
  1214. {$ifndef newcg}
  1215. {$ifdef i386}
  1216. usedinproc:=usedinproc or ($80 shr byte(R_EAX))
  1217. {$endif}
  1218. {$ifdef m68k}
  1219. usedinproc:=usedinproc or ($800 shr word(R_D0))
  1220. {$endif}
  1221. {$endif newcg}
  1222. end
  1223. {
  1224. else if not is_fpu(procinfo^.retdef) then
  1225. should we allow assembler functions of big elements ?
  1226. YES (FK)!!
  1227. Message(parser_e_asm_incomp_with_function_return);
  1228. }
  1229. end;
  1230. { set the framepointer to esp for assembler functions }
  1231. { but only if the are no local variables }
  1232. { added no parameter also (PM) }
  1233. { disable for methods, because self pointer is expected }
  1234. { at -8(%ebp) (JM) }
  1235. { why if se use %esp then self is still at the correct address PM }
  1236. if {not(assigned(procinfo^._class)) and}
  1237. (po_assembler in aktprocsym^.definition^.procoptions) and
  1238. (aktprocsym^.definition^.localst^.datasize=0) and
  1239. (aktprocsym^.definition^.parast^.datasize=0) and
  1240. not(ret_in_param(aktprocsym^.definition^.rettype.def)) then
  1241. begin
  1242. procinfo^.framepointer:=stack_pointer;
  1243. { set the right value for parameters }
  1244. dec(aktprocsym^.definition^.parast^.address_fixup,target_os.size_of_pointer);
  1245. dec(procinfo^.para_offset,target_os.size_of_pointer);
  1246. end;
  1247. { force the asm statement }
  1248. if token<>_ASM then
  1249. consume(_ASM);
  1250. procinfo^.Flags := procinfo^.Flags Or pi_is_assembler;
  1251. assembler_block:=_asm_statement;
  1252. { becuase the END is already read we need to get the
  1253. last_endtoken_filepos here (PFV) }
  1254. last_endtoken_filepos:=tokenpos;
  1255. end;
  1256. end.
  1257. {
  1258. $Log$
  1259. Revision 1.6 2000-08-27 16:11:52 peter
  1260. * moved some util functions from globals,cobjects to cutils
  1261. * splitted files into finput,fmodule
  1262. Revision 1.5 2000/08/12 15:41:15 peter
  1263. * fixed bug 1096 (merged)
  1264. Revision 1.4 2000/08/12 06:46:06 florian
  1265. + case statement for int64/qword implemented
  1266. Revision 1.3 2000/07/13 12:08:27 michael
  1267. + patched to 1.1.0 with former 1.09patch from peter
  1268. Revision 1.2 2000/07/13 11:32:45 michael
  1269. + removed logs
  1270. }