pexpr.pas 78 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030
  1. {
  2. $Id$
  3. Copyright (c) 1998 by Florian Klaempfl
  4. Does parsing of expression for Free Pascal
  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. unit pexpr;
  19. interface
  20. uses symtable,tree;
  21. { reads a whole expression }
  22. function expr : ptree;
  23. { reads an expression without assignements and .. }
  24. function comp_expr(accept_equal : boolean):Ptree;
  25. { reads a single factor }
  26. function factor(getaddr : boolean) : ptree;
  27. { the ID token has to be consumed before calling this function }
  28. procedure do_member_read(getaddr : boolean;const sym : psym;var p1 : ptree;
  29. var pd : pdef;var again : boolean);
  30. function get_intconst:longint;
  31. function get_stringconst:string;
  32. implementation
  33. uses
  34. cobjects,globals,scanner,aasm,pass_1,systems,
  35. hcodegen,types,verbose,strings
  36. { parser specific stuff }
  37. ,pbase,pdecl
  38. { processor specific stuff }
  39. {$ifdef i386}
  40. ,i386
  41. {$endif}
  42. {$ifdef m68k}
  43. ,m68k
  44. {$endif}
  45. ;
  46. function parse_paras(_colon,in_prop_paras : boolean) : ptree;
  47. var
  48. p1,p2 : ptree;
  49. end_of_paras : ttoken;
  50. begin
  51. if in_prop_paras then
  52. end_of_paras:=RECKKLAMMER
  53. else
  54. end_of_paras:=RKLAMMER;
  55. if token=end_of_paras then
  56. begin
  57. parse_paras:=nil;
  58. exit;
  59. end;
  60. p2:=nil;
  61. inc(parsing_para_level);
  62. while true do
  63. begin
  64. p1:=comp_expr(true);
  65. p2:=gencallparanode(p1,p2);
  66. { it's for the str(l:5,s); }
  67. if _colon and (token=COLON) then
  68. begin
  69. consume(COLON);
  70. p1:=comp_expr(true);
  71. p2:=gencallparanode(p1,p2);
  72. p2^.is_colon_para:=true;
  73. if token=COLON then
  74. begin
  75. consume(COLON);
  76. p1:=comp_expr(true);
  77. p2:=gencallparanode(p1,p2);
  78. p2^.is_colon_para:=true;
  79. end
  80. end;
  81. if token=COMMA then
  82. consume(COMMA)
  83. else
  84. break;
  85. end;
  86. dec(parsing_para_level);
  87. parse_paras:=p2;
  88. end;
  89. function statement_syssym(l : longint;var pd : pdef) : ptree;
  90. var
  91. p1,p2 : ptree;
  92. paras : ptree;
  93. prev_in_args : boolean;
  94. Store_valid : boolean;
  95. begin
  96. prev_in_args:=in_args;
  97. Store_valid:=Must_be_valid;
  98. case l of
  99. in_ord_x : begin
  100. consume(LKLAMMER);
  101. in_args:=true;
  102. Must_be_valid:=true;
  103. p1:=comp_expr(true);
  104. consume(RKLAMMER);
  105. do_firstpass(p1);
  106. p1:=geninlinenode(in_ord_x,false,p1);
  107. do_firstpass(p1);
  108. statement_syssym := p1;
  109. pd:=p1^.resulttype;
  110. end;
  111. in_break : begin
  112. statement_syssym:=genzeronode(breakn);
  113. pd:=voiddef;
  114. end;
  115. in_continue : begin
  116. statement_syssym:=genzeronode(continuen);
  117. pd:=voiddef;
  118. end;
  119. in_typeof_x : begin
  120. consume(LKLAMMER);
  121. in_args:=true;
  122. p1:=comp_expr(true);
  123. consume(RKLAMMER);
  124. pd:=voidpointerdef;
  125. if p1^.treetype=typen then
  126. begin
  127. if (p1^.resulttype=nil) then
  128. begin
  129. Message(type_e_mismatch);
  130. statement_syssym:=genzeronode(errorn);
  131. end
  132. else
  133. if p1^.resulttype^.deftype=objectdef then
  134. statement_syssym:=geninlinenode(in_typeof_x,false,p1)
  135. else
  136. begin
  137. Message(type_e_mismatch);
  138. statement_syssym:=genzeronode(errorn);
  139. end;
  140. end
  141. else
  142. begin
  143. Must_be_valid:=false;
  144. do_firstpass(p1);
  145. if (p1^.resulttype=nil) then
  146. begin
  147. Message(type_e_mismatch);
  148. statement_syssym:=genzeronode(errorn)
  149. end
  150. else
  151. if p1^.resulttype^.deftype=objectdef then
  152. statement_syssym:=geninlinenode(in_typeof_x,false,p1)
  153. else
  154. begin
  155. Message(type_e_mismatch);
  156. statement_syssym:=genzeronode(errorn)
  157. end;
  158. end;
  159. end;
  160. in_sizeof_x : begin
  161. consume(LKLAMMER);
  162. in_args:=true;
  163. p1:=comp_expr(true);
  164. consume(RKLAMMER);
  165. pd:=s32bitdef;
  166. if p1^.treetype=typen then
  167. begin
  168. statement_syssym:=genordinalconstnode(p1^.resulttype^.size,pd);
  169. { p1 not needed !}
  170. disposetree(p1);
  171. end
  172. else
  173. begin
  174. Must_be_valid:=false;
  175. do_firstpass(p1);
  176. if ((p1^.resulttype^.deftype=objectdef) and
  177. ((pobjectdef(p1^.resulttype)^.options and oo_hasvirtual)<>0))
  178. or is_open_array(p1^.resulttype) then
  179. statement_syssym:=geninlinenode(in_sizeof_x,false,p1)
  180. else
  181. begin
  182. statement_syssym:=genordinalconstnode(p1^.resulttype^.size,pd);
  183. { p1 not needed !}
  184. disposetree(p1);
  185. end;
  186. end;
  187. end;
  188. in_assigned_x : begin
  189. consume(LKLAMMER);
  190. in_args:=true;
  191. p1:=comp_expr(true);
  192. Must_be_valid:=true;
  193. do_firstpass(p1);
  194. case p1^.resulttype^.deftype of
  195. pointerdef,
  196. procvardef,
  197. classrefdef : ;
  198. objectdef : if not(pobjectdef(p1^.resulttype)^.isclass) then
  199. Message(parser_e_illegal_parameter_list);
  200. else
  201. Message(parser_e_illegal_parameter_list);
  202. end;
  203. p2:=gencallparanode(p1,nil);
  204. p2:=geninlinenode(in_assigned_x,false,p2);
  205. consume(RKLAMMER);
  206. pd:=booldef;
  207. statement_syssym:=p2;
  208. end;
  209. in_ofs_x : begin
  210. consume(LKLAMMER);
  211. in_args:=true;
  212. p1:=comp_expr(true);
  213. p1:=gensinglenode(addrn,p1);
  214. Must_be_valid:=false;
  215. do_firstpass(p1);
  216. { Ofs() returns a longint, not a pointer }
  217. p1^.resulttype:=u32bitdef;
  218. pd:=p1^.resulttype;
  219. consume(RKLAMMER);
  220. statement_syssym:=p1;
  221. end;
  222. in_seg_x : begin
  223. consume(LKLAMMER);
  224. in_args:=true;
  225. p1:=comp_expr(true);
  226. do_firstpass(p1);
  227. if p1^.location.loc<>LOC_REFERENCE then
  228. Message(cg_e_illegal_expression);
  229. p1:=genordinalconstnode(0,s32bitdef);
  230. Must_be_valid:=false;
  231. pd:=s32bitdef;
  232. consume(RKLAMMER);
  233. statement_syssym:=p1;
  234. end;
  235. in_high_x,
  236. in_low_x : begin
  237. consume(LKLAMMER);
  238. in_args:=true;
  239. p1:=comp_expr(true);
  240. do_firstpass(p1);
  241. Must_be_valid:=false;
  242. p2:=geninlinenode(l,false,p1);
  243. consume(RKLAMMER);
  244. pd:=s32bitdef;
  245. statement_syssym:=p2;
  246. end;
  247. in_succ_x,
  248. in_pred_x : begin
  249. consume(LKLAMMER);
  250. in_args:=true;
  251. p1:=comp_expr(true);
  252. do_firstpass(p1);
  253. Must_be_valid:=false;
  254. p2:=geninlinenode(l,false,p1);
  255. consume(RKLAMMER);
  256. pd:=p1^.resulttype;
  257. statement_syssym:=p2;
  258. end;
  259. in_inc_x,
  260. in_dec_x : begin
  261. consume(LKLAMMER);
  262. in_args:=true;
  263. p1:=comp_expr(true);
  264. Must_be_valid:=false;
  265. if token=COMMA then
  266. begin
  267. consume(COMMA);
  268. p2:=gencallparanode(comp_expr(true),nil);
  269. end
  270. else
  271. p2:=nil;
  272. p2:=gencallparanode(p1,p2);
  273. statement_syssym:=geninlinenode(l,false,p2);
  274. consume(RKLAMMER);
  275. pd:=voiddef;
  276. end;
  277. in_concat_x : begin
  278. consume(LKLAMMER);
  279. in_args:=true;
  280. p2:=nil;
  281. while true do
  282. begin
  283. p1:=comp_expr(true);
  284. Must_be_valid:=true;
  285. do_firstpass(p1);
  286. if not((p1^.resulttype^.deftype=stringdef) or
  287. ((p1^.resulttype^.deftype=orddef) and
  288. (porddef(p1^.resulttype)^.typ=uchar))) then
  289. Message(parser_e_illegal_parameter_list);
  290. if p2<>nil then
  291. p2:=gennode(addn,p2,p1)
  292. else
  293. p2:=p1;
  294. if token=COMMA then
  295. consume(COMMA)
  296. else
  297. break;
  298. end;
  299. consume(RKLAMMER);
  300. pd:=cstringdef;
  301. statement_syssym:=p2;
  302. end;
  303. in_read_x,
  304. in_readln_x : begin
  305. if token=LKLAMMER then
  306. begin
  307. consume(LKLAMMER);
  308. in_args:=true;
  309. Must_be_valid:=false;
  310. paras:=parse_paras(false,false);
  311. consume(RKLAMMER);
  312. end
  313. else
  314. paras:=nil;
  315. pd:=voiddef;
  316. p1:=geninlinenode(l,false,paras);
  317. do_firstpass(p1);
  318. statement_syssym := p1;
  319. end;
  320. in_write_x,
  321. in_writeln_x : begin
  322. if token=LKLAMMER then
  323. begin
  324. consume(LKLAMMER);
  325. in_args:=true;
  326. Must_be_valid:=true;
  327. paras:=parse_paras(true,false);
  328. consume(RKLAMMER);
  329. end
  330. else
  331. paras:=nil;
  332. pd:=voiddef;
  333. p1 := geninlinenode(l,false,paras);
  334. do_firstpass(p1);
  335. statement_syssym := p1;
  336. end;
  337. in_str_x_string : begin
  338. consume(LKLAMMER);
  339. in_args:=true;
  340. paras:=parse_paras(true,false);
  341. consume(RKLAMMER);
  342. p1 := geninlinenode(l,false,paras);
  343. do_firstpass(p1);
  344. statement_syssym := p1;
  345. pd:=voiddef;
  346. end;
  347. in_include_x_y,
  348. in_exclude_x_y : begin
  349. consume(LKLAMMER);
  350. in_args:=true;
  351. p1:=comp_expr(true);
  352. Must_be_valid:=false;
  353. consume(COMMA);
  354. p2:=comp_expr(true);
  355. { just a bit lisp feeling }
  356. statement_syssym:=geninlinenode(l,false,gencallparanode(p1,gencallparanode(p2,nil)));
  357. consume(RKLAMMER);
  358. pd:=voiddef;
  359. end;
  360. {in_val_x : begin
  361. consume(LKLAMMER);
  362. paras:=parse_paras(false);
  363. consume(RKLAMMER);
  364. p1 := geninlinenode(l,false,paras);
  365. do_firstpass(p1);
  366. statement_syssym := p1;
  367. pd:=voiddef;
  368. end; }
  369. else
  370. internalerror(15);
  371. end;
  372. in_args:=prev_in_args;
  373. Must_be_valid:=Store_valid;
  374. end;
  375. { reads the parameter for a subroutine call }
  376. procedure do_proc_call(getaddr : boolean;var again : boolean;var p1:Ptree;var pd:Pdef);
  377. var
  378. prev_in_args : boolean;
  379. prevafterassn : boolean;
  380. begin
  381. prev_in_args:=in_args;
  382. prevafterassn:=afterassignment;
  383. afterassignment:=false;
  384. { want we only determine the address of }
  385. { a subroutine ? }
  386. if not(getaddr) then
  387. begin
  388. if token=LKLAMMER then
  389. begin
  390. consume(LKLAMMER);
  391. in_args:=true;
  392. p1^.left:=parse_paras(false,false);
  393. consume(RKLAMMER);
  394. end
  395. else p1^.left:=nil;
  396. { do firstpass because we need the }
  397. { result type }
  398. do_firstpass(p1);
  399. end
  400. else
  401. begin
  402. { address operator @: }
  403. p1^.left:=nil;
  404. { forget pd }
  405. pd:=nil;
  406. { no postfix operators }
  407. again:=false;
  408. end;
  409. pd:=p1^.resulttype;
  410. in_args:=prev_in_args;
  411. afterassignment:=prevafterassn;
  412. end;
  413. { the following procedure handles the access to a property symbol }
  414. procedure handle_propertysym(sym : psym;st : psymtable;var p1 : ptree;
  415. var pd : pdef);
  416. var
  417. paras : ptree;
  418. p2 : ptree;
  419. begin
  420. paras:=nil;
  421. { property parameters? }
  422. if token=LECKKLAMMER then
  423. begin
  424. consume(LECKKLAMMER);
  425. paras:=parse_paras(false,true);
  426. consume(RECKKLAMMER);
  427. end;
  428. { indexed property }
  429. if (ppropertysym(sym)^.options and ppo_indexed)<>0 then
  430. begin
  431. p2:=genordinalconstnode(ppropertysym(sym)^.index,s32bitdef);
  432. paras:=gencallparanode(p2,paras);
  433. end;
  434. if not(afterassignment) and not(in_args) then
  435. begin
  436. { write property: }
  437. { no result }
  438. pd:=voiddef;
  439. if assigned(ppropertysym(sym)^.writeaccesssym) then
  440. begin
  441. if ppropertysym(sym)^.writeaccesssym^.typ=procsym then
  442. begin
  443. { generate the method call }
  444. p1:=genmethodcallnode(pprocsym(
  445. ppropertysym(sym)^.writeaccesssym),st,p1);
  446. { we know the procedure to call, so
  447. force the usage of that procedure }
  448. p1^.procdefinition:=pprocdef(ppropertysym(sym)^.writeaccessdef);
  449. p1^.left:=paras;
  450. consume(ASSIGNMENT);
  451. { read the expression }
  452. p2:=comp_expr(true);
  453. p1^.left:=gencallparanode(p2,p1^.left);
  454. end
  455. else if ppropertysym(sym)^.writeaccesssym^.typ=varsym then
  456. begin
  457. if assigned(paras) then
  458. message(parser_e_no_paras_allowed);
  459. { subscribed access? }
  460. if p1=nil then
  461. begin
  462. p1:=genloadnode(pvarsym(ppropertysym(sym)^.readaccesssym),st);
  463. end
  464. else
  465. p1:=gensubscriptnode(pvarsym(
  466. ppropertysym(sym)^.readaccesssym),p1);
  467. consume(ASSIGNMENT);
  468. { read the expression }
  469. p2:=comp_expr(true);
  470. p1:=gennode(assignn,p1,p2);
  471. end
  472. else
  473. begin
  474. p1:=genzeronode(errorn);
  475. Message(parser_e_no_procedure_to_access_property);
  476. end;
  477. end
  478. else
  479. begin
  480. p1:=genzeronode(errorn);
  481. Message(parser_e_no_procedure_to_access_property);
  482. end;
  483. end
  484. else
  485. begin
  486. { read property: }
  487. pd:=ppropertysym(sym)^.proptype;
  488. if assigned(ppropertysym(sym)^.readaccesssym) then
  489. begin
  490. if ppropertysym(sym)^.readaccesssym^.typ=varsym then
  491. begin
  492. if assigned(paras) then
  493. message(parser_e_no_paras_allowed);
  494. { subscribed access? }
  495. if p1=nil then
  496. begin
  497. p1:=genloadnode(pvarsym(
  498. ppropertysym(sym)^.readaccesssym),st);
  499. end
  500. else
  501. p1:=gensubscriptnode(pvarsym(
  502. ppropertysym(sym)^.readaccesssym),p1);
  503. end
  504. else if ppropertysym(sym)^.readaccesssym^.typ=procsym then
  505. begin
  506. { generate the method call }
  507. p1:=genmethodcallnode(pprocsym(
  508. ppropertysym(sym)^.readaccesssym),st,p1);
  509. { we know the procedure to call, so
  510. force the usage of that procedure }
  511. p1^.procdefinition:=pprocdef(ppropertysym(sym)^.readaccessdef);
  512. { insert paras }
  513. p1^.left:=paras;
  514. { if we should be delphi compatible }
  515. { then force type conversion }
  516. { }
  517. { isn't neccessary, the result types }
  518. { have to match excatly }
  519. {if cs_delphi2_compatible in aktswitches then
  520. p1:=gentypeconvnode(p1,pd);
  521. }
  522. end
  523. else
  524. begin
  525. p1:=genzeronode(errorn);
  526. Message(type_e_mismatch);
  527. end;
  528. end
  529. else
  530. begin
  531. { error, no function to read property }
  532. p1:=genzeronode(errorn);
  533. Message(parser_e_no_procedure_to_access_property);
  534. end;
  535. end;
  536. end;
  537. { the ID token has to be consumed before calling this function }
  538. procedure do_member_read(getaddr : boolean;const sym : psym;var p1 : ptree;
  539. var pd : pdef;var again : boolean);
  540. var
  541. static_name : string;
  542. isclassref : boolean;
  543. begin
  544. if sym=nil then
  545. begin
  546. { pattern is still valid unless
  547. there is another ID just after the ID of sym }
  548. Message1(sym_e_id_no_member,pattern);
  549. disposetree(p1);
  550. p1:=genzeronode(errorn);
  551. { try to clean up }
  552. pd:=generrordef;
  553. again:=false;
  554. end
  555. else
  556. begin
  557. isclassref:=pd^.deftype=classrefdef;
  558. { check protected and private members }
  559. if ((sym^.properties and sp_private)<>0) and
  560. (pobjectdef(sym^.owner^.defowner)^.owner^.symtabletype=unitsymtable) then
  561. Message(parser_e_cant_access_private_member);
  562. { this is wrong protected should not be overwritten but
  563. can be called !! PM
  564. if ((sym^.properties and sp_protected)<>0) and
  565. (pobjectdef(pd)^.owner^.symtabletype=unitsymtable) then
  566. Message(parser_e_cant_access_protected_member); }
  567. { we assume, that only procsyms and varsyms are in an object }
  568. { symbol table, for classes, properties are allowed }
  569. case sym^.typ of
  570. procsym:
  571. begin
  572. p1:=genmethodcallnode(pprocsym(sym),srsymtable,p1);
  573. do_proc_call(getaddr or
  574. (getprocvar and
  575. proc_to_procvar_equal(getprocvardef,pprocsym(sym)^.definition))
  576. ,again,p1,pd);
  577. { now we know the real method e.g. we can check for }
  578. { a class method }
  579. if isclassref and ((p1^.procdefinition^.options and (poclassmethod or poconstructor))=0) then
  580. Message(parser_e_only_class_methods_via_class_ref);
  581. end;
  582. varsym:
  583. begin
  584. if ((sym^.properties and sp_protected)<>0) and
  585. (pobjectdef(pd)^.owner^.symtabletype=unitsymtable) and
  586. not(afterassignment) and
  587. not(in_args) then
  588. Message(parser_e_cant_access_protected_member);
  589. if isclassref then
  590. Message(parser_e_only_class_methods_via_class_ref);
  591. if (sym^.properties and sp_static)<>0 then
  592. begin
  593. static_name:=lower(srsymtable^.name^)+'_'+sym^.name;
  594. getsym(static_name,true);
  595. disposetree(p1);
  596. p1:=genloadnode(pvarsym(srsym),srsymtable);
  597. end
  598. else
  599. p1:=gensubscriptnode(pvarsym(sym),p1);
  600. pd:=pvarsym(sym)^.definition;
  601. end;
  602. propertysym:
  603. begin
  604. if isclassref then
  605. Message(parser_e_only_class_methods_via_class_ref);
  606. handle_propertysym(sym,srsymtable,p1,pd);
  607. end;
  608. else internalerror(16);
  609. end;
  610. end;
  611. end;
  612. {****************************************************************************
  613. Factor
  614. ****************************************************************************}
  615. function factor(getaddr : boolean) : ptree;
  616. var
  617. l : longint;
  618. oldp1,
  619. p1,p2,p3 : ptree;
  620. code : integer;
  621. pd,pd2 : pdef;
  622. possible_error,
  623. unit_specific,
  624. again : boolean;
  625. sym : pvarsym;
  626. classh : pobjectdef;
  627. d : bestreal;
  628. static_name : string;
  629. propsym : ppropertysym;
  630. filepos : tfileposinfo;
  631. {---------------------------------------------
  632. Is_func_ret
  633. ---------------------------------------------}
  634. function is_func_ret(sym : psym) : boolean;
  635. var
  636. p : pprocinfo;
  637. storesymtablestack : psymtable;
  638. begin
  639. is_func_ret:=false;
  640. if (sym^.typ<>funcretsym) and ((procinfo.flags and pi_operator)=0) then
  641. exit;
  642. p:=@procinfo;
  643. while system.assigned(p) do
  644. begin
  645. { is this an access to a function result ? }
  646. if assigned(p^.funcretsym) and
  647. ((pfuncretsym(sym)=p^.funcretsym) or
  648. ((pvarsym(sym)=opsym) and
  649. ((p^.flags and pi_operator)<>0))) and
  650. (p^.retdef<>pdef(voiddef)) and
  651. (token<>LKLAMMER) and
  652. (not ((m_tp in aktmodeswitches) and
  653. (afterassignment or in_args))) then
  654. begin
  655. p1:=genzeronode(funcretn);
  656. pd:=p^.retdef;
  657. p1^.funcretprocinfo:=p;
  658. p1^.retdef:=pd;
  659. is_func_ret:=true;
  660. exit;
  661. end;
  662. p:=p^.parent;
  663. end;
  664. { we must use the function call }
  665. if(sym^.typ=funcretsym) then
  666. begin
  667. storesymtablestack:=symtablestack;
  668. symtablestack:=srsymtable^.next;
  669. getsym(sym^.name,true);
  670. if srsym^.typ<>procsym then
  671. Message(cg_e_illegal_expression);
  672. symtablestack:=storesymtablestack;
  673. end;
  674. end;
  675. {---------------------------------------------
  676. Factor_read_id
  677. ---------------------------------------------}
  678. procedure factor_read_id;
  679. begin
  680. { allow post fix operators }
  681. again:=true;
  682. if (m_result in aktmodeswitches) and
  683. (pattern='RESULT') and
  684. assigned(aktprocsym) and
  685. (procinfo.retdef<>pdef(voiddef)) then
  686. begin
  687. consume(ID);
  688. p1:=genzeronode(funcretn);
  689. pd:=procinfo.retdef;
  690. p1^.funcretprocinfo:=pointer(@procinfo);
  691. p1^.retdef:=pd;
  692. end
  693. else
  694. begin
  695. if lastsymknown then
  696. begin
  697. srsym:=lastsrsym;
  698. srsymtable:=lastsrsymtable;
  699. lastsymknown:=false;
  700. end
  701. else
  702. getsym(pattern,true);
  703. consume(ID);
  704. if not is_func_ret(srsym) then
  705. { else it's a normal symbol }
  706. begin
  707. { is it defined like UNIT.SYMBOL ? }
  708. if srsym^.typ=unitsym then
  709. begin
  710. consume(POINT);
  711. getsymonlyin(punitsym(srsym)^.unitsymtable,pattern);
  712. unit_specific:=true;
  713. consume(ID);
  714. end
  715. else
  716. unit_specific:=false;
  717. if not assigned(srsym) then
  718. Begin
  719. p1:=genzeronode(errorn);
  720. { try to clean up }
  721. pd:=generrordef;
  722. end
  723. else
  724. Begin
  725. { check semantics of private }
  726. if (srsym^.typ in [propertysym,procsym,varsym]) and
  727. (srsymtable^.symtabletype=objectsymtable) then
  728. begin
  729. if ((srsym^.properties and sp_private)<>0) and
  730. (pobjectdef(srsym^.owner^.defowner)^.owner^.symtabletype=unitsymtable) then
  731. Message(parser_e_cant_access_private_member);
  732. end;
  733. case srsym^.typ of
  734. absolutesym : begin
  735. p1:=genloadnode(pvarsym(srsym),srsymtable);
  736. pd:=pabsolutesym(srsym)^.definition;
  737. end;
  738. varsym : begin
  739. { are we in a class method ? }
  740. if (srsymtable^.symtabletype=objectsymtable) and
  741. assigned(aktprocsym) and
  742. ((aktprocsym^.definition^.options and poclassmethod)<>0) then
  743. Message(parser_e_only_class_methods);
  744. if (srsym^.properties and sp_static)<>0 then
  745. begin
  746. static_name:=lower(srsymtable^.name^)+'_'+srsym^.name;
  747. getsym(static_name,true);
  748. end;
  749. p1:=genloadnode(pvarsym(srsym),srsymtable);
  750. if pvarsym(srsym)^.is_valid=0 then
  751. begin
  752. p1^.is_first := true;
  753. { set special between first loaded until checked in firstpass }
  754. pvarsym(srsym)^.is_valid:=2;
  755. end;
  756. pd:=pvarsym(srsym)^.definition;
  757. end;
  758. typedconstsym : begin
  759. p1:=gentypedconstloadnode(ptypedconstsym(srsym),srsymtable);
  760. pd:=ptypedconstsym(srsym)^.definition;
  761. end;
  762. syssym : p1:=statement_syssym(psyssym(srsym)^.number,pd);
  763. typesym : begin
  764. pd:=ptypesym(srsym)^.definition;
  765. if not assigned(pd) then
  766. begin
  767. pd:=generrordef;
  768. again:=false;
  769. end
  770. else
  771. { if we read a type declaration }
  772. { we have to return the type and }
  773. { nothing else }
  774. if block_type=bt_type then
  775. begin
  776. p1:=genzeronode(typen);
  777. p1^.resulttype:=pd;
  778. pd:=voiddef;
  779. end
  780. else
  781. begin
  782. if token=LKLAMMER then
  783. begin
  784. consume(LKLAMMER);
  785. p1:=comp_expr(true);
  786. consume(RKLAMMER);
  787. p1:=gentypeconvnode(p1,pd);
  788. p1^.explizit:=true;
  789. end
  790. else
  791. if (token=POINT) and
  792. (pd^.deftype=objectdef) and
  793. ((pobjectdef(pd)^.options and oois_class)=0) then
  794. begin
  795. consume(POINT);
  796. if assigned(procinfo._class) then
  797. begin
  798. if procinfo._class^.isrelated(pobjectdef(pd)) then
  799. begin
  800. p1:=genzeronode(typen);
  801. p1^.resulttype:=pd;
  802. srsymtable:=pobjectdef(pd)^.publicsyms;
  803. sym:=pvarsym(srsymtable^.search(pattern));
  804. { search also in inherited methods }
  805. while sym=nil do
  806. begin
  807. pd:=pobjectdef(pd)^.childof;
  808. srsymtable:=pobjectdef(pd)^.publicsyms;
  809. sym:=pvarsym(srsymtable^.search(pattern));
  810. end;
  811. consume(ID);
  812. do_member_read(false,sym,p1,pd,again);
  813. end
  814. else
  815. begin
  816. Message(parser_e_no_super_class);
  817. pd:=generrordef;
  818. again:=false;
  819. end;
  820. end
  821. else
  822. begin
  823. { allows @TObject.Load }
  824. { also allows static methods and variables }
  825. p1:=genzeronode(typen);
  826. p1^.resulttype:=pd;
  827. { srsymtable:=pobjectdef(pd)^.publicsyms;
  828. sym:=pvarsym(srsymtable^.search(pattern)); }
  829. { TP allows also @TMenu.Load if Load is only }
  830. { defined in an anchestor class }
  831. sym:=pvarsym(search_class_member(pobjectdef(pd),pattern));
  832. if not(getaddr) and ((sym^.properties and sp_static)=0) then
  833. Message(sym_e_only_static_in_static)
  834. else
  835. begin
  836. consume(ID);
  837. do_member_read(getaddr,sym,p1,pd,again);
  838. end;
  839. end;
  840. end
  841. else
  842. begin
  843. { class reference ? }
  844. if (pd^.deftype=objectdef)
  845. and ((pobjectdef(pd)^.options and oois_class)<>0) then
  846. begin
  847. p1:=genzeronode(typen);
  848. p1^.resulttype:=pd;
  849. pd:=new(pclassrefdef,init(pd));
  850. p1:=gensinglenode(loadvmtn,p1);
  851. p1^.resulttype:=pd;
  852. end
  853. else
  854. begin
  855. { generate a type node }
  856. { (for typeof etc) }
  857. p1:=genzeronode(typen);
  858. p1^.resulttype:=pd;
  859. pd:=voiddef;
  860. end;
  861. end;
  862. end;
  863. end;
  864. enumsym : begin
  865. p1:=genenumnode(penumsym(srsym));
  866. pd:=p1^.resulttype;
  867. end;
  868. constsym : begin
  869. case pconstsym(srsym)^.consttype of
  870. constint : p1:=genordinalconstnode(pconstsym(srsym)^.value,s32bitdef);
  871. conststring : p1:=genstringconstnode(pstring(pconstsym(srsym)^.value)^);
  872. constchar : p1:=genordinalconstnode(pconstsym(srsym)^.value,cchardef);
  873. constreal : p1:=genrealconstnode(pbestreal(pconstsym(srsym)^.value)^);
  874. constbool : p1:=genordinalconstnode(pconstsym(srsym)^.value,booldef);
  875. constset : p1:=gensetconstnode(pconstset(pconstsym(srsym)^.value),
  876. psetdef(pconstsym(srsym)^.definition));
  877. constord : p1:=genordinalconstnode(pconstsym(srsym)^.value,
  878. pconstsym(srsym)^.definition);
  879. end;
  880. pd:=p1^.resulttype;
  881. end;
  882. procsym : begin
  883. { are we in a class method ? }
  884. possible_error:=(srsymtable^.symtabletype=objectsymtable) and
  885. assigned(aktprocsym) and
  886. ((aktprocsym^.definition^.options and poclassmethod)<>0);
  887. p1:=gencallnode(pprocsym(srsym),srsymtable);
  888. p1^.unit_specific:=unit_specific;
  889. do_proc_call(getaddr or
  890. (getprocvar and
  891. proc_to_procvar_equal(getprocvardef,pprocsym(srsym)^.definition)),
  892. again,p1,pd);
  893. if possible_error and
  894. ((p1^.procdefinition^.options and poclassmethod)=0) then
  895. Message(parser_e_only_class_methods);
  896. end;
  897. propertysym : begin
  898. { access to property in a method }
  899. { are we in a class method ? }
  900. if (srsymtable^.symtabletype=objectsymtable) and
  901. assigned(aktprocsym) and
  902. ((aktprocsym^.definition^.options and poclassmethod)<>0) then
  903. Message(parser_e_only_class_methods);
  904. { no method pointer }
  905. p1:=nil;
  906. handle_propertysym(srsym,srsymtable,p1,pd);
  907. end;
  908. errorsym : begin
  909. p1:=genzeronode(errorn);
  910. pd:=generrordef;
  911. if token=LKLAMMER then
  912. begin
  913. consume(LKLAMMER);
  914. parse_paras(false,false);
  915. consume(RKLAMMER);
  916. end;
  917. end;
  918. else
  919. begin
  920. p1:=genzeronode(errorn);
  921. pd:=generrordef;
  922. Message(cg_e_illegal_expression);
  923. end;
  924. end; { end case }
  925. end;
  926. end;
  927. end;
  928. end;
  929. {---------------------------------------------
  930. Factor_Read_Set
  931. ---------------------------------------------}
  932. { Read a set between [] }
  933. function factor_read_set:ptree;
  934. var
  935. p1,
  936. lastp,
  937. buildp : ptree;
  938. begin
  939. buildp:=nil;
  940. { be sure that a least one arrayconstructn is used, also for an
  941. empty [] }
  942. if token=RECKKLAMMER then
  943. buildp:=gennode(arrayconstructn,nil,buildp)
  944. else
  945. begin
  946. while true do
  947. begin
  948. p1:=comp_expr(true);
  949. do_firstpass(p1);
  950. if codegenerror then
  951. break;
  952. if token=POINTPOINT then
  953. begin
  954. consume(POINTPOINT);
  955. p2:=comp_expr(true);
  956. do_firstpass(p2);
  957. if codegenerror then
  958. break;
  959. p1:=gennode(arrayconstructrangen,p1,p2);
  960. end;
  961. { insert at the end of the tree, to get the correct order }
  962. if not assigned(buildp) then
  963. begin
  964. buildp:=gensinglenode(arrayconstructn,p1);
  965. lastp:=buildp;
  966. end
  967. else
  968. begin
  969. lastp^.right:=gensinglenode(arrayconstructn,p1);
  970. lastp:=lastp^.right;
  971. end;
  972. { there could be more elements }
  973. if token=COMMA then
  974. consume(COMMA)
  975. else
  976. break;
  977. end;
  978. end;
  979. factor_read_set:=buildp;
  980. end;
  981. {---------------------------------------------
  982. Helpers
  983. ---------------------------------------------}
  984. procedure check_tokenpos;
  985. begin
  986. if (p1<>oldp1) then
  987. begin
  988. if assigned(p1) then
  989. set_tree_filepos(p1,filepos);
  990. oldp1:=p1;
  991. filepos:=tokenpos;
  992. end;
  993. end;
  994. {---------------------------------------------
  995. PostFixOperators
  996. ---------------------------------------------}
  997. procedure postfixoperators;
  998. { p1 and p2 must contain valid value_str }
  999. begin
  1000. check_tokenpos;
  1001. while again do
  1002. begin
  1003. { prevent crashes with unknown types }
  1004. if not assigned(pd) then
  1005. exit;
  1006. case token of
  1007. CARET : begin
  1008. consume(CARET);
  1009. if pd^.deftype<>pointerdef then
  1010. begin
  1011. { ^ as binary operator is a problem!!!! (FK) }
  1012. again:=false;
  1013. Message(cg_e_invalid_qualifier);
  1014. disposetree(p1);
  1015. p1:=genzeronode(errorn);
  1016. end
  1017. else
  1018. begin
  1019. p1:=gensinglenode(derefn,p1);
  1020. pd:=ppointerdef(pd)^.definition;
  1021. end;
  1022. end;
  1023. LECKKLAMMER : begin
  1024. if (pd^.deftype=objectdef) and pobjectdef(pd)^.isclass then
  1025. begin
  1026. { default property }
  1027. propsym:=search_default_property(pobjectdef(pd));
  1028. if not(assigned(propsym)) then
  1029. begin
  1030. disposetree(p1);
  1031. p1:=genzeronode(errorn);
  1032. again:=false;
  1033. message(parser_e_no_default_property_available);
  1034. end
  1035. else
  1036. begin
  1037. p1:=nil;
  1038. handle_propertysym(propsym,propsym^.owner,p1,pd);
  1039. end;
  1040. end
  1041. else
  1042. begin
  1043. consume(LECKKLAMMER);
  1044. repeat
  1045. case pd^.deftype of
  1046. pointerdef : begin
  1047. p2:=comp_expr(true);
  1048. p1:=gennode(vecn,p1,p2);
  1049. pd:=ppointerdef(pd)^.definition;
  1050. end;
  1051. stringdef : begin
  1052. p2:=comp_expr(true);
  1053. p1:=gennode(vecn,p1,p2);
  1054. pd:=cchardef
  1055. end;
  1056. arraydef : begin
  1057. p2:=comp_expr(true);
  1058. {$ifdef i386}
  1059. { support SEG:OFS for go32v2 Mem[] }
  1060. if (target_info.target=target_GO32V2) and
  1061. (p1^.treetype=loadn) and
  1062. assigned(p1^.symtableentry) and
  1063. assigned(p1^.symtableentry^.owner^.name) and
  1064. (p1^.symtableentry^.owner^.name^='SYSTEM') and
  1065. ((p1^.symtableentry^.name='MEM') or
  1066. (p1^.symtableentry^.name='MEMW') or
  1067. (p1^.symtableentry^.name='MEML')) then
  1068. begin
  1069. if (token=COLON) then
  1070. begin
  1071. consume(COLON);
  1072. p3:=gennode(muln,genordinalconstnode($10,s32bitdef),p2);
  1073. p2:=comp_expr(true);
  1074. p2:=gennode(addn,p2,p3);
  1075. p1:=gennode(vecn,p1,p2);
  1076. p1^.memseg:=true;
  1077. p1^.memindex:=true;
  1078. end
  1079. else
  1080. begin
  1081. p1:=gennode(vecn,p1,p2);
  1082. p1^.memindex:=true;
  1083. end;
  1084. end
  1085. else
  1086. {$endif}
  1087. p1:=gennode(vecn,p1,p2);
  1088. pd:=parraydef(pd)^.definition;
  1089. end;
  1090. else
  1091. begin
  1092. Message(cg_e_invalid_qualifier);
  1093. disposetree(p1);
  1094. p1:=genzeronode(errorn);
  1095. again:=false;
  1096. end;
  1097. end;
  1098. if token=COMMA then
  1099. consume(COMMA)
  1100. else
  1101. break;
  1102. until false;
  1103. consume(RECKKLAMMER);
  1104. end;
  1105. end;
  1106. POINT : begin
  1107. consume(POINT);
  1108. case pd^.deftype of
  1109. recorddef : begin
  1110. sym:=pvarsym(precdef(pd)^.symtable^.search(pattern));
  1111. consume(ID);
  1112. if sym=nil then
  1113. begin
  1114. Message(sym_e_illegal_field);
  1115. disposetree(p1);
  1116. p1:=genzeronode(errorn);
  1117. end
  1118. else
  1119. begin
  1120. p1:=gensubscriptnode(sym,p1);
  1121. pd:=sym^.definition;
  1122. end;
  1123. end;
  1124. classrefdef : begin
  1125. classh:=pobjectdef(pclassrefdef(pd)^.definition);
  1126. sym:=nil;
  1127. while assigned(classh) do
  1128. begin
  1129. sym:=pvarsym(classh^.publicsyms^.search(pattern));
  1130. srsymtable:=classh^.publicsyms;
  1131. if assigned(sym) then
  1132. break;
  1133. classh:=classh^.childof;
  1134. end;
  1135. consume(ID);
  1136. do_member_read(false,sym,p1,pd,again);
  1137. end;
  1138. objectdef : begin
  1139. classh:=pobjectdef(pd);
  1140. sym:=nil;
  1141. while assigned(classh) do
  1142. begin
  1143. sym:=pvarsym(classh^.publicsyms^.search(pattern));
  1144. srsymtable:=classh^.publicsyms;
  1145. if assigned(sym) then
  1146. break;
  1147. classh:=classh^.childof;
  1148. end;
  1149. consume(ID);
  1150. do_member_read(false,sym,p1,pd,again);
  1151. end;
  1152. pointerdef : begin
  1153. Message(cg_e_invalid_qualifier);
  1154. if ppointerdef(pd)^.definition^.deftype in [recorddef,objectdef,classrefdef] then
  1155. Message(parser_h_maybe_deref_caret_missing);
  1156. end;
  1157. else
  1158. begin
  1159. Message(cg_e_invalid_qualifier);
  1160. disposetree(p1);
  1161. p1:=genzeronode(errorn);
  1162. end;
  1163. end;
  1164. end;
  1165. else
  1166. begin
  1167. { is this a procedure variable ? }
  1168. if assigned(pd) then
  1169. begin
  1170. if (pd^.deftype=procvardef) then
  1171. begin
  1172. if getprocvar and proc_to_procvar_equal(pprocvardef(pd),getprocvardef) then
  1173. again:=false
  1174. else
  1175. if (token=LKLAMMER) or
  1176. ((pprocvardef(pd)^.para1=nil) and
  1177. (not((token in [ASSIGNMENT,UNEQUAL,EQUAL]))) and
  1178. (not afterassignment) and
  1179. (not in_args)) then
  1180. begin
  1181. { do this in a strange way }
  1182. { it's not a clean solution }
  1183. p2:=p1;
  1184. p1:=gencallnode(nil,nil);
  1185. p1^.right:=p2;
  1186. p1^.unit_specific:=unit_specific;
  1187. p1^.symtableprocentry:=sym;
  1188. if token=LKLAMMER then
  1189. begin
  1190. consume(LKLAMMER);
  1191. p1^.left:=parse_paras(false,false);
  1192. consume(RKLAMMER);
  1193. end;
  1194. pd:=pprocvardef(pd)^.retdef;
  1195. { proc():= is never possible }
  1196. if token=ASSIGNMENT then
  1197. begin
  1198. Message(cg_e_illegal_expression);
  1199. p1:=genzeronode(errorn);
  1200. again:=false;
  1201. end;
  1202. p1^.resulttype:=pd;
  1203. end
  1204. else
  1205. again:=false;
  1206. p1^.resulttype:=pd;
  1207. end
  1208. else
  1209. again:=false;
  1210. end
  1211. else
  1212. again:=false;
  1213. end;
  1214. end;
  1215. check_tokenpos;
  1216. end; { while again }
  1217. end;
  1218. {---------------------------------------------
  1219. Factor (Main)
  1220. ---------------------------------------------}
  1221. begin
  1222. oldp1:=nil;
  1223. p1:=nil;
  1224. filepos:=tokenpos;
  1225. if token=ID then
  1226. begin
  1227. factor_read_id;
  1228. { handle post fix operators }
  1229. postfixoperators;
  1230. end
  1231. else
  1232. case token of
  1233. _NEW : begin
  1234. consume(_NEW);
  1235. consume(LKLAMMER);
  1236. p1:=factor(false);
  1237. if p1^.treetype<>typen then
  1238. Message(type_e_type_id_expected);
  1239. pd:=p1^.resulttype;
  1240. pd2:=pd;
  1241. if (pd^.deftype<>pointerdef) or
  1242. (ppointerdef(pd)^.definition^.deftype<>objectdef) then
  1243. begin
  1244. Message(parser_e_pointer_to_class_expected);
  1245. { if an error occurs, read til the end of
  1246. the new statement }
  1247. p1:=genzeronode(errorn);
  1248. l:=1;
  1249. while true do
  1250. begin
  1251. case token of
  1252. LKLAMMER : inc(l);
  1253. RKLAMMER : dec(l);
  1254. end;
  1255. consume(token);
  1256. if l=0 then
  1257. break;
  1258. end;
  1259. end
  1260. else
  1261. begin
  1262. disposetree(p1);
  1263. p1:=genzeronode(hnewn);
  1264. p1^.resulttype:=ppointerdef(pd)^.definition;
  1265. consume(COMMA);
  1266. afterassignment:=false;
  1267. { determines the current object defintion }
  1268. classh:=pobjectdef(ppointerdef(pd)^.definition);
  1269. { check for an abstract class }
  1270. if (classh^.options and oois_abstract)<>0 then
  1271. Message(sym_e_no_instance_of_abstract_object);
  1272. { search the constructor also in the symbol tables of
  1273. the parents }
  1274. { no constructor found }
  1275. sym:=nil;
  1276. while assigned(classh) do
  1277. begin
  1278. sym:=pvarsym(classh^.publicsyms^.search(pattern));
  1279. srsymtable:=classh^.publicsyms;
  1280. if assigned(sym) then
  1281. break;
  1282. classh:=classh^.childof;
  1283. end;
  1284. consume(ID);
  1285. do_member_read(false,sym,p1,pd,again);
  1286. if (p1^.treetype<>calln) or
  1287. (assigned(p1^.procdefinition) and
  1288. ((p1^.procdefinition^.options and poconstructor)=0)) then
  1289. Message(parser_e_expr_have_to_be_constructor_call);
  1290. p1:=gensinglenode(newn,p1);
  1291. { set the resulttype }
  1292. p1^.resulttype:=pd2;
  1293. consume(RKLAMMER);
  1294. end;
  1295. end;
  1296. _SELF : begin
  1297. again:=true;
  1298. consume(_SELF);
  1299. if not assigned(procinfo._class) then
  1300. begin
  1301. p1:=genzeronode(errorn);
  1302. pd:=generrordef;
  1303. again:=false;
  1304. Message(parser_e_self_not_in_method);
  1305. end
  1306. else
  1307. begin
  1308. if (aktprocsym^.definition^.options and poclassmethod)<>0 then
  1309. begin
  1310. { self in class methods is a class reference type }
  1311. pd:=new(pclassrefdef,init(procinfo._class));
  1312. p1:=genselfnode(pd);
  1313. p1^.resulttype:=pd;
  1314. end
  1315. else
  1316. begin
  1317. p1:=genselfnode(procinfo._class);
  1318. p1^.resulttype:=procinfo._class;
  1319. end;
  1320. pd:=p1^.resulttype;
  1321. postfixoperators;
  1322. end;
  1323. end;
  1324. _INHERITED : begin
  1325. again:=true;
  1326. consume(_INHERITED);
  1327. if assigned(procinfo._class) then
  1328. begin
  1329. classh:=procinfo._class^.childof;
  1330. while assigned(classh) do
  1331. begin
  1332. srsymtable:=pobjectdef(classh)^.publicsyms;
  1333. sym:=pvarsym(srsymtable^.search(pattern));
  1334. if assigned(sym) then
  1335. begin
  1336. p1:=genzeronode(typen);
  1337. p1^.resulttype:=classh;
  1338. pd:=p1^.resulttype;
  1339. consume(ID);
  1340. do_member_read(false,sym,p1,pd,again);
  1341. break;
  1342. end;
  1343. classh:=classh^.childof;
  1344. end;
  1345. if classh=nil then
  1346. begin
  1347. Message1(sym_e_id_no_member,pattern);
  1348. again:=false;
  1349. pd:=generrordef;
  1350. p1:=genzeronode(errorn);
  1351. end;
  1352. end
  1353. else
  1354. begin
  1355. Message(parser_e_generic_methods_only_in_methods);
  1356. again:=false;
  1357. pd:=generrordef;
  1358. p1:=genzeronode(errorn);
  1359. end;
  1360. postfixoperators;
  1361. end;
  1362. INTCONST : begin
  1363. valint(pattern,l,code);
  1364. if code<>0 then
  1365. begin
  1366. val(pattern,d,code);
  1367. if code<>0 then
  1368. begin
  1369. Message(cg_e_invalid_integer);
  1370. consume(INTCONST);
  1371. l:=1;
  1372. p1:=genordinalconstnode(l,s32bitdef);
  1373. end
  1374. else
  1375. begin
  1376. consume(INTCONST);
  1377. p1:=genrealconstnode(d);
  1378. end;
  1379. end
  1380. else
  1381. begin
  1382. consume(INTCONST);
  1383. p1:=genordinalconstnode(l,s32bitdef);
  1384. end;
  1385. end;
  1386. REALNUMBER : begin
  1387. val(pattern,d,code);
  1388. if code<>0 then
  1389. begin
  1390. Message(parser_e_error_in_real);
  1391. d:=1.0;
  1392. end;
  1393. consume(REALNUMBER);
  1394. p1:=genrealconstnode(d);
  1395. end;
  1396. _STRING : begin
  1397. { STRING can be also a type cast }
  1398. pd:=stringtype;
  1399. consume(LKLAMMER);
  1400. p1:=comp_expr(true);
  1401. consume(RKLAMMER);
  1402. p1:=gentypeconvnode(p1,pd);
  1403. p1^.explizit:=true;
  1404. { handle postfix operators here e.g. string(a)[10] }
  1405. again:=true;
  1406. postfixoperators;
  1407. end;
  1408. _FILE : begin
  1409. { FILE can be also a type cast }
  1410. pd:=cfiledef;
  1411. consume(_FILE);
  1412. if token=LKLAMMER then
  1413. begin
  1414. consume(LKLAMMER);
  1415. p1:=comp_expr(true);
  1416. consume(RKLAMMER);
  1417. p1:=gentypeconvnode(p1,pd);
  1418. end
  1419. else
  1420. begin
  1421. p1:=genzeronode(typen);
  1422. p1^.resulttype:=pd;
  1423. end;
  1424. p1^.explizit:=true;
  1425. { handle postfix operators here e.g. string(a)[10] }
  1426. again:=true;
  1427. postfixoperators;
  1428. end;
  1429. CSTRING : begin
  1430. p1:=genstringconstnode(pattern);
  1431. consume(CSTRING);
  1432. end;
  1433. CCHAR : begin
  1434. p1:=genordinalconstnode(ord(pattern[1]),cchardef);
  1435. consume(CCHAR);
  1436. end;
  1437. KLAMMERAFFE : begin
  1438. consume(KLAMMERAFFE);
  1439. p1:=factor(true);
  1440. p1:=gensinglenode(addrn,p1);
  1441. end;
  1442. LKLAMMER : begin
  1443. consume(LKLAMMER);
  1444. p1:=comp_expr(true);
  1445. consume(RKLAMMER);
  1446. { it's not a good solution }
  1447. { but (a+b)^ makes some problems }
  1448. if token in [CARET,POINT,LECKKLAMMER] then
  1449. begin
  1450. { we need the resulttype }
  1451. { of the expression in pd }
  1452. do_firstpass(p1);
  1453. pd:=p1^.resulttype;
  1454. again:=true;
  1455. postfixoperators;
  1456. end;
  1457. end;
  1458. LECKKLAMMER : begin
  1459. consume(LECKKLAMMER);
  1460. p1:=factor_read_set;
  1461. consume(RECKKLAMMER);
  1462. end;
  1463. PLUS : begin
  1464. consume(PLUS);
  1465. p1:=factor(false);
  1466. end;
  1467. MINUS : begin
  1468. consume(MINUS);
  1469. p1:=factor(false);
  1470. p1:=gensinglenode(umminusn,p1);
  1471. end;
  1472. _NOT : begin
  1473. consume(_NOT);
  1474. p1:=factor(false);
  1475. p1:=gensinglenode(notn,p1);
  1476. end;
  1477. _TRUE : begin
  1478. consume(_TRUE);
  1479. p1:=genordinalconstnode(1,booldef);
  1480. end;
  1481. _FALSE : begin
  1482. consume(_FALSE);
  1483. p1:=genordinalconstnode(0,booldef);
  1484. end;
  1485. _NIL : begin
  1486. consume(_NIL);
  1487. p1:=genzeronode(niln);
  1488. end;
  1489. else
  1490. begin
  1491. p1:=genzeronode(errorn);
  1492. consume(token);
  1493. Message(cg_e_illegal_expression);
  1494. end;
  1495. end;
  1496. { generate error node if no node is created }
  1497. if not assigned(p1) then
  1498. p1:=genzeronode(errorn);
  1499. factor:=p1;
  1500. check_tokenpos;
  1501. end;
  1502. {****************************************************************************
  1503. Sub_Expr
  1504. ****************************************************************************}
  1505. type
  1506. Toperator_precedence=(opcompare,opaddition,opmultiply);
  1507. Ttok2nodeRec=record
  1508. tok : ttoken;
  1509. nod : ttreetyp;
  1510. end;
  1511. const
  1512. tok2nodes=23;
  1513. tok2node:array[1..tok2nodes] of ttok2noderec=(
  1514. (tok:PLUS ;nod:addn),
  1515. (tok:MINUS ;nod:subn),
  1516. (tok:STAR ;nod:muln),
  1517. (tok:SLASH ;nod:slashn),
  1518. (tok:EQUAL ;nod:equaln),
  1519. (tok:GT ;nod:gtn),
  1520. (tok:LT ;nod:ltn),
  1521. (tok:GTE ;nod:gten),
  1522. (tok:LTE ;nod:lten),
  1523. (tok:SYMDIF ;nod:symdifn),
  1524. (tok:STARSTAR;nod:starstarn),
  1525. (tok:CARET ;nod:caretn),
  1526. (tok:UNEQUAL ;nod:unequaln),
  1527. (tok:_AS ;nod:asn),
  1528. (tok:_IN ;nod:inn),
  1529. (tok:_IS ;nod:isn),
  1530. (tok:_OR ;nod:orn),
  1531. (tok:_AND ;nod:andn),
  1532. (tok:_DIV ;nod:divn),
  1533. (tok:_MOD ;nod:modn),
  1534. (tok:_SHL ;nod:shln),
  1535. (tok:_SHR ;nod:shrn),
  1536. (tok:_XOR ;nod:xorn)
  1537. );
  1538. operator_levels:array[Toperator_precedence] of set of Ttoken=
  1539. ([LT,LTE,GT,GTE,EQUAL,UNEQUAL,_IN,_IS],
  1540. [PLUS,MINUS,_OR,_XOR],
  1541. [CARET,SYMDIF,STARSTAR,STAR,SLASH,_DIV,_MOD,_AND,_SHL,_SHR,_AS]);
  1542. function sub_expr(pred_level:Toperator_precedence;accept_equal : boolean):Ptree;
  1543. {Reads a subexpression while the operators are of the current precedence
  1544. level, or any higher level. Replaces the old term, simpl_expr and
  1545. simpl2_expr.}
  1546. var
  1547. low,high,mid : longint;
  1548. p1,p2 : Ptree;
  1549. oldt : Ttoken;
  1550. filepos : tfileposinfo;
  1551. begin
  1552. if pred_level=opmultiply then
  1553. p1:=factor(false)
  1554. else
  1555. p1:=sub_expr(succ(pred_level),true);
  1556. repeat
  1557. if (token in operator_levels[pred_level]) and
  1558. ((token<>EQUAL) or accept_equal) then
  1559. begin
  1560. oldt:=token;
  1561. filepos:=tokenpos;
  1562. consume(token);
  1563. if pred_level=opmultiply then
  1564. p2:=factor(false)
  1565. else
  1566. p2:=sub_expr(succ(pred_level),true);
  1567. low:=1;
  1568. high:=tok2nodes;
  1569. while (low<high) do
  1570. begin
  1571. mid:=(low+high+1) shr 1;
  1572. if oldt<tok2node[mid].tok then
  1573. high:=mid-1
  1574. else
  1575. low:=mid;
  1576. end;
  1577. if tok2node[high].tok=oldt then
  1578. p1:=gennode(tok2node[high].nod,p1,p2)
  1579. else
  1580. p1:=gennode(nothingn,p1,p2);
  1581. set_tree_filepos(p1,filepos);
  1582. end
  1583. else
  1584. break;
  1585. until false;
  1586. sub_expr:=p1;
  1587. end;
  1588. function comp_expr(accept_equal : boolean):Ptree;
  1589. var
  1590. oldafterassignment : boolean;
  1591. begin
  1592. oldafterassignment:=afterassignment;
  1593. afterassignment:=true;
  1594. comp_expr:=sub_expr(opcompare,accept_equal);
  1595. afterassignment:=oldafterassignment;
  1596. end;
  1597. function expr : ptree;
  1598. var
  1599. p1,p2 : ptree;
  1600. oldafterassignment : boolean;
  1601. oldp1 : ptree;
  1602. filepos : tfileposinfo;
  1603. begin
  1604. oldafterassignment:=afterassignment;
  1605. p1:=sub_expr(opcompare,true);
  1606. if token in [ASSIGNMENT,_PLUSASN,_MINUSASN,_STARASN,_SLASHASN] then
  1607. afterassignment:=true;
  1608. filepos:=tokenpos;
  1609. oldp1:=p1;
  1610. case token of
  1611. POINTPOINT : begin
  1612. consume(POINTPOINT);
  1613. p2:=sub_expr(opcompare,true);
  1614. p1:=gennode(rangen,p1,p2);
  1615. end;
  1616. ASSIGNMENT : begin
  1617. consume(ASSIGNMENT);
  1618. { avoid a firstpass of a procedure if
  1619. it must be assigned to a procvar }
  1620. { should be recursive for a:=b:=c !!! }
  1621. if (p1^.resulttype<>nil) and (p1^.resulttype^.deftype=procvardef) then
  1622. begin
  1623. getprocvar:=true;
  1624. getprocvardef:=pprocvardef(p1^.resulttype);
  1625. end;
  1626. p2:=sub_expr(opcompare,true);
  1627. if getprocvar and (p2^.treetype=calln) and
  1628. (proc_to_procvar_equal(getprocvardef,pprocsym(p2^.symtableentry)^.definition)) then
  1629. begin
  1630. p2^.treetype:=loadn;
  1631. p2^.resulttype:=pprocsym(p2^.symtableprocentry)^.definition;
  1632. p2^.symtableentry:=p2^.symtableprocentry;
  1633. end;
  1634. getprocvar:=false;
  1635. p1:=gennode(assignn,p1,p2);
  1636. end;
  1637. { this is the code for C like assignements }
  1638. { from an improvement of Peter Schaefer }
  1639. _PLUSASN : begin
  1640. consume(_PLUSASN );
  1641. p2:=sub_expr(opcompare,true);
  1642. p1:=gennode(assignn,p1,gennode(addn,getcopy(p1),p2));
  1643. { was first
  1644. p1:=gennode(assignn,p1,gennode(addn,p1,p2));
  1645. but disposetree assumes that we have a real
  1646. *** tree *** }
  1647. end;
  1648. _MINUSASN : begin
  1649. consume(_MINUSASN );
  1650. p2:=sub_expr(opcompare,true);
  1651. p1:=gennode(assignn,p1,gennode(subn,getcopy(p1),p2));
  1652. end;
  1653. _STARASN : begin
  1654. consume(_STARASN );
  1655. p2:=sub_expr(opcompare,true);
  1656. p1:=gennode(assignn,p1,gennode(muln,getcopy(p1),p2));
  1657. end;
  1658. _SLASHASN : begin
  1659. consume(_SLASHASN );
  1660. p2:=sub_expr(opcompare,true);
  1661. p1:=gennode(assignn,p1,gennode(slashn,getcopy(p1),p2));
  1662. end;
  1663. end;
  1664. afterassignment:=oldafterassignment;
  1665. if p1<>oldp1 then
  1666. set_tree_filepos(p1,filepos);
  1667. expr:=p1;
  1668. end;
  1669. function get_intconst:longint;
  1670. {Reads an expression, tries to evalute it and check if it is an integer
  1671. constant. Then the constant is returned.}
  1672. var
  1673. p:Ptree;
  1674. begin
  1675. p:=comp_expr(true);
  1676. do_firstpass(p);
  1677. if (p^.treetype<>ordconstn) and
  1678. (p^.resulttype^.deftype=orddef) and
  1679. not(Porddef(p^.resulttype)^.typ in [uvoid,uchar,bool8bit,bool16bit,bool32bit]) then
  1680. Message(cg_e_illegal_expression)
  1681. else
  1682. get_intconst:=p^.value;
  1683. disposetree(p);
  1684. end;
  1685. function get_stringconst:string;
  1686. {Reads an expression, tries to evaluate it and checks if it is a string
  1687. constant. Then the constant is returned.}
  1688. var
  1689. p:Ptree;
  1690. begin
  1691. get_stringconst:='';
  1692. p:=comp_expr(true);
  1693. do_firstpass(p);
  1694. if p^.treetype<>stringconstn then
  1695. begin
  1696. if (p^.treetype=ordconstn) and
  1697. (p^.resulttype^.deftype=orddef) and
  1698. (Porddef(p^.resulttype)^.typ=uchar) then
  1699. get_stringconst:=char(p^.value)
  1700. else
  1701. Message(cg_e_illegal_expression);
  1702. end
  1703. else
  1704. {$ifdef UseAnsiString}
  1705. get_stringconst:=strpas(p^.value_str);
  1706. {$else UseAnsiString}
  1707. get_stringconst:=p^.value_str^;
  1708. {$endif UseAnsiString}
  1709. disposetree(p);
  1710. end;
  1711. end.
  1712. {
  1713. $Log$
  1714. Revision 1.59 1998-10-01 14:56:24 peter
  1715. * crash preventions
  1716. Revision 1.58 1998/09/30 07:40:35 florian
  1717. * better error recovering
  1718. Revision 1.57 1998/09/28 16:18:16 florian
  1719. * two fixes to get ansi strings work
  1720. Revision 1.56 1998/09/26 17:45:36 peter
  1721. + idtoken and only one token table
  1722. Revision 1.55 1998/09/24 23:49:10 peter
  1723. + aktmodeswitches
  1724. Revision 1.54 1998/09/23 15:46:39 florian
  1725. * problem with with and classes fixed
  1726. Revision 1.53 1998/09/23 09:58:54 peter
  1727. * first working array of const things
  1728. Revision 1.52 1998/09/20 09:38:45 florian
  1729. * hasharray for defs fixed
  1730. * ansistring code generation corrected (init/final, assignement)
  1731. Revision 1.51 1998/09/18 16:03:43 florian
  1732. * some changes to compile with Delphi
  1733. Revision 1.50 1998/09/17 13:41:18 pierre
  1734. sizeof(TPOINT) problem
  1735. Revision 1.49.2.1 1998/09/17 08:42:31 pierre
  1736. TPOINT sizeof fix
  1737. Revision 1.49 1998/09/09 11:50:53 pierre
  1738. * forward def are not put in record or objects
  1739. + added check for forwards also in record and objects
  1740. * dummy parasymtable for unit initialization removed from
  1741. symtable stack
  1742. Revision 1.48 1998/09/07 22:25:53 peter
  1743. * fixed str(boolean,string) which was allowed
  1744. * fixed write(' ':<int expression>) only constants where allowed :(
  1745. Revision 1.47 1998/09/07 18:46:10 peter
  1746. * update smartlinking, uses getdatalabel
  1747. * renamed ptree.value vars to value_str,value_real,value_set
  1748. Revision 1.46 1998/09/04 08:42:03 peter
  1749. * updated some error messages
  1750. Revision 1.45 1998/09/01 17:39:49 peter
  1751. + internal constant functions
  1752. Revision 1.44 1998/08/28 10:54:24 peter
  1753. * fixed smallset generation from elements, it has never worked before!
  1754. Revision 1.43 1998/08/23 16:07:24 florian
  1755. * internalerror with mod/div fixed
  1756. Revision 1.42 1998/08/21 14:08:50 pierre
  1757. + TEST_FUNCRET now default (old code removed)
  1758. works also for m68k (at least compiles)
  1759. Revision 1.41 1998/08/20 21:36:39 peter
  1760. * fixed 'with object do' bug
  1761. Revision 1.40 1998/08/20 09:26:41 pierre
  1762. + funcret setting in underproc testing
  1763. compile with _dTEST_FUNCRET
  1764. Revision 1.39 1998/08/18 16:48:48 pierre
  1765. * bug for -So proc assignment to p^rocvar fixed
  1766. Revision 1.38 1998/08/18 14:17:09 pierre
  1767. * bug about assigning the return value of a function to
  1768. a procvar fixed : warning
  1769. assigning a proc to a procvar need @ in FPC mode !!
  1770. * missing file/line info restored
  1771. Revision 1.37 1998/08/18 09:24:43 pierre
  1772. * small warning position bug fixed
  1773. * support_mmx switches splitting was missing
  1774. * rhide error and warning output corrected
  1775. Revision 1.36 1998/08/15 16:50:29 peter
  1776. * fixed proc()=expr which was not allowed anymore by my previous fix
  1777. Revision 1.35 1998/08/14 18:18:46 peter
  1778. + dynamic set contruction
  1779. * smallsets are now working (always longint size)
  1780. Revision 1.34 1998/08/13 11:00:12 peter
  1781. * fixed procedure<>procedure construct
  1782. Revision 1.33 1998/08/11 15:31:39 peter
  1783. * write extended to ppu file
  1784. * new version 0.99.7
  1785. Revision 1.32 1998/08/11 14:05:32 peter
  1786. * fixed sizeof(array of char)
  1787. Revision 1.31 1998/08/10 14:50:11 peter
  1788. + localswitches, moduleswitches, globalswitches splitting
  1789. Revision 1.30 1998/07/28 21:52:54 florian
  1790. + implementation of raise and try..finally
  1791. + some misc. exception stuff
  1792. Revision 1.29 1998/07/27 21:57:13 florian
  1793. * fix to allow tv like stream registration:
  1794. @tmenu.load doesn't work if load had parameters or if load was only
  1795. declared in an anchestor class of tmenu
  1796. Revision 1.28 1998/07/14 21:46:51 peter
  1797. * updated messages file
  1798. Revision 1.27 1998/06/25 14:04:23 peter
  1799. + internal inc/dec
  1800. Revision 1.26 1998/06/09 16:01:46 pierre
  1801. + added procedure directive parsing for procvars
  1802. (accepted are popstack cdecl and pascal)
  1803. + added C vars with the following syntax
  1804. var C calias 'true_c_name';(can be followed by external)
  1805. reason is that you must add the Cprefix
  1806. which is target dependent
  1807. Revision 1.25 1998/06/05 14:37:33 pierre
  1808. * fixes for inline for operators
  1809. * inline procedure more correctly restricted
  1810. Revision 1.24 1998/06/04 23:51:52 peter
  1811. * m68k compiles
  1812. + .def file creation moved to gendef.pas so it could also be used
  1813. for win32
  1814. Revision 1.23 1998/06/04 09:55:40 pierre
  1815. * demangled name of procsym reworked to become independant of the mangling scheme
  1816. Revision 1.22 1998/06/02 17:03:03 pierre
  1817. * with node corrected for objects
  1818. * small bugs for SUPPORT_MMX fixed
  1819. Revision 1.21 1998/05/27 19:45:05 peter
  1820. * symtable.pas splitted into includefiles
  1821. * symtable adapted for $ifdef NEWPPU
  1822. Revision 1.20 1998/05/26 07:53:59 pierre
  1823. * bug fix for empty sets (nil pd was dereferenced )
  1824. Revision 1.19 1998/05/25 17:11:43 pierre
  1825. * firstpasscount bug fixed
  1826. now all is already set correctly the first time
  1827. under EXTDEBUG try -gp to skip all other firstpasses
  1828. it works !!
  1829. * small bug fixes
  1830. - for smallsets with -dTESTSMALLSET
  1831. - some warnings removed (by correcting code !)
  1832. Revision 1.18 1998/05/23 01:21:20 peter
  1833. + aktasmmode, aktoptprocessor, aktoutputformat
  1834. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  1835. + $LIBNAME to set the library name where the unit will be put in
  1836. * splitted cgi386 a bit (codeseg to large for bp7)
  1837. * nasm, tasm works again. nasm moved to ag386nsm.pas
  1838. Revision 1.17 1998/05/22 12:37:03 carl
  1839. * crash bugfix (patched msanually to main branch)
  1840. Revision 1.16 1998/05/21 19:33:32 peter
  1841. + better procedure directive handling and only one table
  1842. Revision 1.15 1998/05/20 09:42:35 pierre
  1843. + UseTokenInfo now default
  1844. * unit in interface uses and implementation uses gives error now
  1845. * only one error for unknown symbol (uses lastsymknown boolean)
  1846. the problem came from the label code !
  1847. + first inlined procedures and function work
  1848. (warning there might be allowed cases were the result is still wrong !!)
  1849. * UseBrower updated gives a global list of all position of all used symbols
  1850. with switch -gb
  1851. Revision 1.14 1998/05/11 13:07:56 peter
  1852. + $ifdef NEWPPU for the new ppuformat
  1853. + $define GDB not longer required
  1854. * removed all warnings and stripped some log comments
  1855. * no findfirst/findnext anymore to remove smartlink *.o files
  1856. Revision 1.13 1998/05/06 08:38:45 pierre
  1857. * better position info with UseTokenInfo
  1858. UseTokenInfo greatly simplified
  1859. + added check for changed tree after first time firstpass
  1860. (if we could remove all the cases were it happen
  1861. we could skip all firstpass if firstpasscount > 1)
  1862. Only with ExtDebug
  1863. Revision 1.12 1998/05/05 12:05:42 florian
  1864. * problems with properties fixed
  1865. * crash fixed: i:=l when i and l are undefined, was a problem with
  1866. implementation of private/protected
  1867. Revision 1.11 1998/05/04 11:22:26 florian
  1868. * problem with DOM solved: it crashes when accessing a property in a method
  1869. Revision 1.10 1998/05/01 16:38:45 florian
  1870. * handling of private and protected fixed
  1871. + change_keywords_to_tp implemented to remove
  1872. keywords which aren't supported by tp
  1873. * break and continue are now symbols of the system unit
  1874. + widestring, longstring and ansistring type released
  1875. Revision 1.9 1998/04/29 10:33:58 pierre
  1876. + added some code for ansistring (not complete nor working yet)
  1877. * corrected operator overloading
  1878. * corrected nasm output
  1879. + started inline procedures
  1880. + added starstarn : use ** for exponentiation (^ gave problems)
  1881. + started UseTokenInfo cond to get accurate positions
  1882. Revision 1.8 1998/04/14 23:27:03 florian
  1883. + exclude/include with constant second parameter added
  1884. Revision 1.7 1998/04/09 23:02:15 florian
  1885. * small problems solved to get remake3 work
  1886. Revision 1.6 1998/04/09 22:16:35 florian
  1887. * problem with previous REGALLOC solved
  1888. * improved property support
  1889. Revision 1.5 1998/04/08 10:26:09 florian
  1890. * correct error handling of virtual constructors
  1891. * problem with new type declaration handling fixed
  1892. Revision 1.4 1998/04/07 22:45:05 florian
  1893. * bug0092, bug0115 and bug0121 fixed
  1894. + packed object/class/array
  1895. Revision 1.3 1998/04/07 13:19:46 pierre
  1896. * bugfixes for reset_gdb_info
  1897. in MEM parsing for go32v2
  1898. better external symbol creation
  1899. support for rhgdb.exe (lowercase file names)
  1900. }