pexpr.pas 97 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620
  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. globtype,systems,tokens,
  35. cobjects,globals,scanner,
  36. symconst,aasm,
  37. hcodegen,types,verbose,strings,
  38. {$ifndef newcg}
  39. tccal,
  40. {$endif newcg}
  41. pass_1,
  42. { parser specific stuff }
  43. pbase,pdecl,
  44. { processor specific stuff }
  45. cpubase,cpuinfo;
  46. const
  47. allow_type : boolean = true;
  48. got_addrn : boolean = false;
  49. function parse_paras(__colon,in_prop_paras : boolean) : ptree;
  50. var
  51. p1,p2 : ptree;
  52. end_of_paras : ttoken;
  53. begin
  54. if in_prop_paras then
  55. end_of_paras:=_RECKKLAMMER
  56. else
  57. end_of_paras:=_RKLAMMER;
  58. if token=end_of_paras then
  59. begin
  60. parse_paras:=nil;
  61. exit;
  62. end;
  63. p2:=nil;
  64. inc(parsing_para_level);
  65. while true do
  66. begin
  67. p1:=comp_expr(true);
  68. p2:=gencallparanode(p1,p2);
  69. { it's for the str(l:5,s); }
  70. if __colon and (token=_COLON) then
  71. begin
  72. consume(_COLON);
  73. p1:=comp_expr(true);
  74. p2:=gencallparanode(p1,p2);
  75. p2^.is_colon_para:=true;
  76. if token=_COLON then
  77. begin
  78. consume(_COLON);
  79. p1:=comp_expr(true);
  80. p2:=gencallparanode(p1,p2);
  81. p2^.is_colon_para:=true;
  82. end
  83. end;
  84. if token=_COMMA then
  85. consume(_COMMA)
  86. else
  87. break;
  88. end;
  89. dec(parsing_para_level);
  90. parse_paras:=p2;
  91. end;
  92. procedure check_tp_procvar(var p : ptree);
  93. var
  94. p1 : ptree;
  95. Store_valid : boolean;
  96. begin
  97. if (m_tp_procvar in aktmodeswitches) and
  98. (not got_addrn) and
  99. (not in_args) and
  100. (p^.treetype=loadn) then
  101. begin
  102. { support if procvar then for tp7 and many other expression like this }
  103. Store_valid:=Must_be_valid;
  104. Must_be_valid:=false;
  105. do_firstpass(p);
  106. Must_be_valid:=Store_valid;
  107. if not(getprocvar) and (p^.resulttype^.deftype=procvardef) then
  108. begin
  109. p1:=gencallnode(nil,nil);
  110. p1^.right:=p;
  111. p1^.resulttype:=pprocvardef(p^.resulttype)^.retdef;
  112. firstpass(p1);
  113. p:=p1;
  114. end;
  115. end;
  116. end;
  117. function statement_syssym(l : longint;var pd : pdef) : ptree;
  118. var
  119. p1,p2,paras : ptree;
  120. prev_in_args : boolean;
  121. Store_valid : boolean;
  122. begin
  123. prev_in_args:=in_args;
  124. Store_valid:=Must_be_valid;
  125. case l of
  126. in_ord_x :
  127. begin
  128. consume(_LKLAMMER);
  129. in_args:=true;
  130. Must_be_valid:=true;
  131. p1:=comp_expr(true);
  132. consume(_RKLAMMER);
  133. do_firstpass(p1);
  134. p1:=geninlinenode(in_ord_x,false,p1);
  135. do_firstpass(p1);
  136. statement_syssym := p1;
  137. pd:=p1^.resulttype;
  138. end;
  139. in_break :
  140. begin
  141. statement_syssym:=genzeronode(breakn);
  142. pd:=voiddef;
  143. end;
  144. in_continue :
  145. begin
  146. statement_syssym:=genzeronode(continuen);
  147. pd:=voiddef;
  148. end;
  149. in_typeof_x :
  150. begin
  151. consume(_LKLAMMER);
  152. in_args:=true;
  153. {allow_type:=true;}
  154. p1:=comp_expr(true);
  155. {allow_type:=false;}
  156. consume(_RKLAMMER);
  157. pd:=voidpointerdef;
  158. if p1^.treetype=typen then
  159. begin
  160. if (p1^.typenodetype=nil) then
  161. begin
  162. Message(type_e_mismatch);
  163. statement_syssym:=genzeronode(errorn);
  164. end
  165. else
  166. if p1^.typenodetype^.deftype=objectdef then
  167. begin
  168. { we can use resulttype in pass_2 (PM) }
  169. p1^.resulttype:=p1^.typenodetype;
  170. statement_syssym:=geninlinenode(in_typeof_x,false,p1);
  171. end
  172. else
  173. begin
  174. Message(type_e_mismatch);
  175. disposetree(p1);
  176. statement_syssym:=genzeronode(errorn);
  177. end;
  178. end
  179. else { not a type node }
  180. begin
  181. Must_be_valid:=false;
  182. do_firstpass(p1);
  183. if (p1^.resulttype=nil) then
  184. begin
  185. Message(type_e_mismatch);
  186. disposetree(p1);
  187. statement_syssym:=genzeronode(errorn)
  188. end
  189. else
  190. if p1^.resulttype^.deftype=objectdef then
  191. statement_syssym:=geninlinenode(in_typeof_x,false,p1)
  192. else
  193. begin
  194. Message(type_e_mismatch);
  195. statement_syssym:=genzeronode(errorn);
  196. disposetree(p1);
  197. end;
  198. end;
  199. end;
  200. in_sizeof_x :
  201. begin
  202. consume(_LKLAMMER);
  203. in_args:=true;
  204. {allow_type:=true;}
  205. p1:=comp_expr(true);
  206. {allow_type:=false; }
  207. consume(_RKLAMMER);
  208. pd:=s32bitdef;
  209. if p1^.treetype=typen then
  210. begin
  211. statement_syssym:=genordinalconstnode(p1^.typenodetype^.size,pd);
  212. { p1 not needed !}
  213. disposetree(p1);
  214. end
  215. else
  216. begin
  217. Must_be_valid:=false;
  218. do_firstpass(p1);
  219. if ((p1^.resulttype^.deftype=objectdef) and
  220. (oo_has_constructor in pobjectdef(p1^.resulttype)^.objectoptions)) or
  221. is_open_array(p1^.resulttype) or
  222. is_open_string(p1^.resulttype) then
  223. statement_syssym:=geninlinenode(in_sizeof_x,false,p1)
  224. else
  225. begin
  226. statement_syssym:=genordinalconstnode(p1^.resulttype^.size,pd);
  227. { p1 not needed !}
  228. disposetree(p1);
  229. end;
  230. end;
  231. end;
  232. in_assigned_x :
  233. begin
  234. consume(_LKLAMMER);
  235. in_args:=true;
  236. p1:=comp_expr(true);
  237. Must_be_valid:=true;
  238. do_firstpass(p1);
  239. case p1^.resulttype^.deftype of
  240. pointerdef,
  241. procvardef,
  242. classrefdef : ;
  243. objectdef : if not(pobjectdef(p1^.resulttype)^.is_class) then
  244. Message(parser_e_illegal_parameter_list);
  245. else
  246. Message(parser_e_illegal_parameter_list);
  247. end;
  248. p2:=gencallparanode(p1,nil);
  249. p2:=geninlinenode(in_assigned_x,false,p2);
  250. consume(_RKLAMMER);
  251. pd:=booldef;
  252. statement_syssym:=p2;
  253. end;
  254. in_ofs_x :
  255. begin
  256. consume(_LKLAMMER);
  257. in_args:=true;
  258. p1:=comp_expr(true);
  259. p1:=gensinglenode(addrn,p1);
  260. Must_be_valid:=false;
  261. do_firstpass(p1);
  262. { Ofs() returns a longint, not a pointer }
  263. p1^.resulttype:=u32bitdef;
  264. pd:=p1^.resulttype;
  265. consume(_RKLAMMER);
  266. statement_syssym:=p1;
  267. end;
  268. in_addr_x :
  269. begin
  270. consume(_LKLAMMER);
  271. in_args:=true;
  272. p1:=comp_expr(true);
  273. p1:=gensinglenode(addrn,p1);
  274. Must_be_valid:=false;
  275. do_firstpass(p1);
  276. pd:=p1^.resulttype;
  277. consume(_RKLAMMER);
  278. statement_syssym:=p1;
  279. end;
  280. in_seg_x :
  281. begin
  282. consume(_LKLAMMER);
  283. in_args:=true;
  284. p1:=comp_expr(true);
  285. do_firstpass(p1);
  286. if p1^.location.loc<>LOC_REFERENCE then
  287. Message(cg_e_illegal_expression);
  288. p1:=genordinalconstnode(0,s32bitdef);
  289. Must_be_valid:=false;
  290. pd:=s32bitdef;
  291. consume(_RKLAMMER);
  292. statement_syssym:=p1;
  293. end;
  294. in_high_x,
  295. in_low_x :
  296. begin
  297. consume(_LKLAMMER);
  298. in_args:=true;
  299. {allow_type:=true;}
  300. p1:=comp_expr(true);
  301. {allow_type:=false;}
  302. do_firstpass(p1);
  303. if p1^.treetype=typen then
  304. p1^.resulttype:=p1^.typenodetype;
  305. Must_be_valid:=false;
  306. p2:=geninlinenode(l,false,p1);
  307. consume(_RKLAMMER);
  308. pd:=s32bitdef;
  309. statement_syssym:=p2;
  310. end;
  311. in_succ_x,
  312. in_pred_x :
  313. begin
  314. consume(_LKLAMMER);
  315. in_args:=true;
  316. p1:=comp_expr(true);
  317. do_firstpass(p1);
  318. Must_be_valid:=false;
  319. p2:=geninlinenode(l,false,p1);
  320. consume(_RKLAMMER);
  321. pd:=p1^.resulttype;
  322. statement_syssym:=p2;
  323. end;
  324. in_inc_x,
  325. in_dec_x :
  326. begin
  327. consume(_LKLAMMER);
  328. in_args:=true;
  329. p1:=comp_expr(true);
  330. Must_be_valid:=false;
  331. if token=_COMMA then
  332. begin
  333. consume(_COMMA);
  334. p2:=gencallparanode(comp_expr(true),nil);
  335. end
  336. else
  337. p2:=nil;
  338. p2:=gencallparanode(p1,p2);
  339. statement_syssym:=geninlinenode(l,false,p2);
  340. consume(_RKLAMMER);
  341. pd:=voiddef;
  342. end;
  343. in_concat_x :
  344. begin
  345. consume(_LKLAMMER);
  346. in_args:=true;
  347. p2:=nil;
  348. while true do
  349. begin
  350. p1:=comp_expr(true);
  351. Must_be_valid:=true;
  352. do_firstpass(p1);
  353. if not((p1^.resulttype^.deftype=stringdef) or
  354. ((p1^.resulttype^.deftype=orddef) and
  355. (porddef(p1^.resulttype)^.typ=uchar))) then
  356. Message(parser_e_illegal_parameter_list);
  357. if p2<>nil then
  358. p2:=gennode(addn,p2,p1)
  359. else
  360. p2:=p1;
  361. if token=_COMMA then
  362. consume(_COMMA)
  363. else
  364. break;
  365. end;
  366. consume(_RKLAMMER);
  367. pd:=cshortstringdef;
  368. statement_syssym:=p2;
  369. end;
  370. in_read_x,
  371. in_readln_x :
  372. begin
  373. if token=_LKLAMMER then
  374. begin
  375. consume(_LKLAMMER);
  376. in_args:=true;
  377. Must_be_valid:=false;
  378. paras:=parse_paras(false,false);
  379. consume(_RKLAMMER);
  380. end
  381. else
  382. paras:=nil;
  383. pd:=voiddef;
  384. p1:=geninlinenode(l,false,paras);
  385. do_firstpass(p1);
  386. statement_syssym := p1;
  387. end;
  388. in_write_x,
  389. in_writeln_x :
  390. begin
  391. if token=_LKLAMMER then
  392. begin
  393. consume(_LKLAMMER);
  394. in_args:=true;
  395. Must_be_valid:=true;
  396. paras:=parse_paras(true,false);
  397. consume(_RKLAMMER);
  398. end
  399. else
  400. paras:=nil;
  401. pd:=voiddef;
  402. p1 := geninlinenode(l,false,paras);
  403. do_firstpass(p1);
  404. statement_syssym := p1;
  405. end;
  406. in_str_x_string :
  407. begin
  408. consume(_LKLAMMER);
  409. in_args:=true;
  410. paras:=parse_paras(true,false);
  411. consume(_RKLAMMER);
  412. p1 := geninlinenode(l,false,paras);
  413. do_firstpass(p1);
  414. statement_syssym := p1;
  415. pd:=voiddef;
  416. end;
  417. in_val_x:
  418. Begin
  419. consume(_LKLAMMER);
  420. in_args := true;
  421. p1:= gencallparanode(comp_expr(true), nil);
  422. Must_be_valid := False;
  423. consume(_COMMA);
  424. p2 := gencallparanode(comp_expr(true),p1);
  425. if (token = _COMMA) then
  426. Begin
  427. consume(_COMMA);
  428. p2 := gencallparanode(comp_expr(true),p2)
  429. End;
  430. consume(_RKLAMMER);
  431. p2 := geninlinenode(l,false,p2);
  432. do_firstpass(p2);
  433. statement_syssym := p2;
  434. pd := voiddef;
  435. End;
  436. in_include_x_y,
  437. in_exclude_x_y :
  438. begin
  439. consume(_LKLAMMER);
  440. in_args:=true;
  441. p1:=comp_expr(true);
  442. Must_be_valid:=false;
  443. consume(_COMMA);
  444. p2:=comp_expr(true);
  445. statement_syssym:=geninlinenode(l,false,gencallparanode(p1,gencallparanode(p2,nil)));
  446. consume(_RKLAMMER);
  447. pd:=voiddef;
  448. end;
  449. in_assert_x_y :
  450. begin
  451. consume(_LKLAMMER);
  452. in_args:=true;
  453. p1:=comp_expr(true);
  454. if token=_COMMA then
  455. begin
  456. consume(_COMMA);
  457. p2:=comp_expr(true);
  458. end
  459. else
  460. begin
  461. { then insert an empty string }
  462. p2:=genstringconstnode('');
  463. end;
  464. statement_syssym:=geninlinenode(l,false,gencallparanode(p1,gencallparanode(p2,nil)));
  465. consume(_RKLAMMER);
  466. pd:=voiddef;
  467. end;
  468. else
  469. internalerror(15);
  470. end;
  471. in_args:=prev_in_args;
  472. Must_be_valid:=Store_valid;
  473. end;
  474. { reads the parameter for a subroutine call }
  475. procedure do_proc_call(getaddr : boolean;var again : boolean;var p1:Ptree;var pd:Pdef);
  476. var
  477. prev_in_args : boolean;
  478. prevafterassn : boolean;
  479. begin
  480. prev_in_args:=in_args;
  481. prevafterassn:=afterassignment;
  482. afterassignment:=false;
  483. { want we only determine the address of }
  484. { a subroutine ? }
  485. if not(getaddr) then
  486. begin
  487. if token=_LKLAMMER then
  488. begin
  489. consume(_LKLAMMER);
  490. in_args:=true;
  491. p1^.left:=parse_paras(false,false);
  492. consume(_RKLAMMER);
  493. end
  494. else p1^.left:=nil;
  495. { do firstpass because we need the }
  496. { result type }
  497. do_firstpass(p1);
  498. end
  499. else
  500. begin
  501. { address operator @: }
  502. p1^.left:=nil;
  503. { forget pd }
  504. pd:=nil;
  505. if (p1^.symtableproc^.symtabletype=withsymtable) and
  506. (p1^.symtableproc^.defowner^.deftype=objectdef) then
  507. begin
  508. p1^.methodpointer:=getcopy(pwithsymtable(p1^.symtableproc)^.withrefnode);
  509. end
  510. else if not(assigned(p1^.methodpointer)) then
  511. begin
  512. { we must provide a method pointer, if it isn't given, }
  513. { it is self }
  514. p1^.methodpointer:=genselfnode(procinfo._class);
  515. p1^.methodpointer^.resulttype:=procinfo._class;
  516. end;
  517. { no postfix operators }
  518. again:=false;
  519. end;
  520. pd:=p1^.resulttype;
  521. in_args:=prev_in_args;
  522. afterassignment:=prevafterassn;
  523. end;
  524. procedure handle_procvar(procvar : pprocvardef;var t : ptree);
  525. var
  526. hp : ptree;
  527. begin
  528. hp:=nil;
  529. if (proc_to_procvar_equal(pprocsym(t^.symtableentry)^.definition,procvar)) then
  530. begin
  531. if (po_methodpointer in procvar^.procoptions) then
  532. hp:=genloadmethodcallnode(pprocsym(t^.symtableprocentry),t^.symtable,getcopy(t^.methodpointer))
  533. else
  534. hp:=genloadcallnode(pprocsym(t^.symtableprocentry),t^.symtable);
  535. end;
  536. if assigned(hp) then
  537. begin
  538. disposetree(t);
  539. t:=hp;
  540. end;
  541. end;
  542. { the following procedure handles the access to a property symbol }
  543. procedure handle_propertysym(sym : psym;st : psymtable;var p1 : ptree;
  544. var pd : pdef);
  545. var
  546. paras : ptree;
  547. p2 : ptree;
  548. plist : ppropsymlist;
  549. begin
  550. paras:=nil;
  551. { property parameters? }
  552. if token=_LECKKLAMMER then
  553. begin
  554. consume(_LECKKLAMMER);
  555. paras:=parse_paras(false,true);
  556. consume(_RECKKLAMMER);
  557. end;
  558. { indexed property }
  559. if (ppo_indexed in ppropertysym(sym)^.propoptions) then
  560. begin
  561. p2:=genordinalconstnode(ppropertysym(sym)^.index,s32bitdef);
  562. paras:=gencallparanode(p2,paras);
  563. end;
  564. { we need only a write property if a := follows }
  565. { if not(afterassignment) and not(in_args) then }
  566. if token=_ASSIGNMENT then
  567. begin
  568. { write property: }
  569. { no result }
  570. pd:=voiddef;
  571. if assigned(ppropertysym(sym)^.writeaccesssym) then
  572. begin
  573. case ppropertysym(sym)^.writeaccesssym^.sym^.typ of
  574. procsym :
  575. begin
  576. { generate the method call }
  577. p1:=genmethodcallnode(pprocsym(ppropertysym(sym)^.writeaccesssym^.sym),st,p1);
  578. { we know the procedure to call, so
  579. force the usage of that procedure }
  580. p1^.procdefinition:=pprocdef(ppropertysym(sym)^.writeaccessdef);
  581. p1^.left:=paras;
  582. consume(_ASSIGNMENT);
  583. { read the expression }
  584. getprocvar:=ppropertysym(sym)^.proptype^.deftype=procvardef;
  585. p2:=comp_expr(true);
  586. if getprocvar then
  587. begin
  588. if (p2^.treetype=calln) then
  589. handle_procvar(pprocvardef(ppropertysym(sym)^.proptype),p2)
  590. else
  591. if (p2^.treetype=typeconvn) and
  592. (p2^.left^.treetype=calln) then
  593. handle_procvar(pprocvardef(ppropertysym(sym)^.proptype),p2^.left);
  594. end;
  595. p1^.left:=gencallparanode(p2,p1^.left);
  596. getprocvar:=false;
  597. end;
  598. varsym :
  599. begin
  600. if assigned(paras) then
  601. message(parser_e_no_paras_allowed);
  602. { subscribed access? }
  603. plist:=ppropertysym(sym)^.writeaccesssym;
  604. while assigned(plist) do
  605. begin
  606. if p1=nil then
  607. p1:=genloadnode(pvarsym(plist^.sym),st)
  608. else
  609. p1:=gensubscriptnode(pvarsym(plist^.sym),p1);
  610. plist:=plist^.next;
  611. end;
  612. consume(_ASSIGNMENT);
  613. { read the expression }
  614. p2:=comp_expr(true);
  615. p1:=gennode(assignn,p1,p2);
  616. end
  617. else
  618. begin
  619. p1:=genzeronode(errorn);
  620. Message(parser_e_no_procedure_to_access_property);
  621. end;
  622. end;
  623. end
  624. else
  625. begin
  626. p1:=genzeronode(errorn);
  627. Message(parser_e_no_procedure_to_access_property);
  628. end;
  629. end
  630. else
  631. begin
  632. { read property: }
  633. pd:=ppropertysym(sym)^.proptype;
  634. if assigned(ppropertysym(sym)^.readaccesssym) then
  635. begin
  636. case ppropertysym(sym)^.readaccesssym^.sym^.typ of
  637. varsym :
  638. begin
  639. if assigned(paras) then
  640. message(parser_e_no_paras_allowed);
  641. { subscribed access? }
  642. plist:=ppropertysym(sym)^.readaccesssym;
  643. while assigned(plist) do
  644. begin
  645. if p1=nil then
  646. p1:=genloadnode(pvarsym(plist^.sym),st)
  647. else
  648. p1:=gensubscriptnode(pvarsym(plist^.sym),p1);
  649. plist:=plist^.next;
  650. end;
  651. end;
  652. procsym :
  653. begin
  654. { generate the method call }
  655. p1:=genmethodcallnode(pprocsym(ppropertysym(sym)^.readaccesssym^.sym),st,p1);
  656. { we know the procedure to call, so
  657. force the usage of that procedure }
  658. p1^.procdefinition:=pprocdef(ppropertysym(sym)^.readaccessdef);
  659. { insert paras }
  660. p1^.left:=paras;
  661. end
  662. else
  663. begin
  664. p1:=genzeronode(errorn);
  665. Message(type_e_mismatch);
  666. end;
  667. end;
  668. end
  669. else
  670. begin
  671. { error, no function to read property }
  672. p1:=genzeronode(errorn);
  673. Message(parser_e_no_procedure_to_access_property);
  674. end;
  675. end;
  676. end;
  677. { the ID token has to be consumed before calling this function }
  678. procedure do_member_read(getaddr : boolean;const sym : psym;var p1 : ptree;
  679. var pd : pdef;var again : boolean);
  680. var
  681. static_name : string;
  682. isclassref : boolean;
  683. begin
  684. if sym=nil then
  685. begin
  686. { pattern is still valid unless
  687. there is another ID just after the ID of sym }
  688. Message1(sym_e_id_no_member,pattern);
  689. disposetree(p1);
  690. p1:=genzeronode(errorn);
  691. { try to clean up }
  692. pd:=generrordef;
  693. again:=false;
  694. end
  695. else
  696. begin
  697. isclassref:=pd^.deftype=classrefdef;
  698. { check protected and private members }
  699. { please leave this code as it is, }
  700. { it has now the same behaviaor as TP/Delphi }
  701. if (sp_private in sym^.symoptions) and
  702. (pobjectdef(pd)^.owner^.symtabletype=unitsymtable) then
  703. Message(parser_e_cant_access_private_member);
  704. if (sp_protected in sym^.symoptions) and
  705. (pobjectdef(pd)^.owner^.symtabletype=unitsymtable) then
  706. begin
  707. if assigned(aktprocsym^.definition^._class) then
  708. begin
  709. if not aktprocsym^.definition^._class^.is_related(pobjectdef(sym^.owner^.defowner)) then
  710. Message(parser_e_cant_access_protected_member);
  711. end
  712. else
  713. Message(parser_e_cant_access_protected_member);
  714. end;
  715. { we assume, that only procsyms and varsyms are in an object }
  716. { symbol table, for classes, properties are allowed }
  717. case sym^.typ of
  718. procsym:
  719. begin
  720. p1:=genmethodcallnode(pprocsym(sym),srsymtable,p1);
  721. do_proc_call(getaddr or
  722. (getprocvar and
  723. (m_tp_procvar in aktmodeswitches) and
  724. proc_to_procvar_equal(pprocsym(sym)^.definition,getprocvardef))
  725. ,again,p1,pd);
  726. { now we know the real method e.g. we can check for a class method }
  727. if isclassref and
  728. assigned(p1^.procdefinition) and
  729. not(po_classmethod in p1^.procdefinition^.procoptions) and
  730. not(p1^.procdefinition^.proctypeoption=potype_constructor) then
  731. Message(parser_e_only_class_methods_via_class_ref);
  732. end;
  733. varsym:
  734. begin
  735. if isclassref then
  736. Message(parser_e_only_class_methods_via_class_ref);
  737. if (sp_static in sym^.symoptions) then
  738. begin
  739. { static_name:=lower(srsymtable^.name^)+'_'+sym^.name;
  740. this is wrong for static field in with symtable (PM) }
  741. static_name:=lower(srsym^.owner^.name^)+'_'+sym^.name;
  742. getsym(static_name,true);
  743. disposetree(p1);
  744. p1:=genloadnode(pvarsym(srsym),srsymtable);
  745. end
  746. else
  747. p1:=gensubscriptnode(pvarsym(sym),p1);
  748. pd:=pvarsym(sym)^.definition;
  749. end;
  750. propertysym:
  751. begin
  752. if isclassref then
  753. Message(parser_e_only_class_methods_via_class_ref);
  754. handle_propertysym(sym,srsymtable,p1,pd);
  755. end;
  756. else internalerror(16);
  757. end;
  758. end;
  759. end;
  760. {****************************************************************************
  761. Factor
  762. ****************************************************************************}
  763. function factor(getaddr : boolean) : ptree;
  764. var
  765. l : longint;
  766. oldp1,
  767. p1,p2,p3 : ptree;
  768. code : integer;
  769. pd,pd2 : pdef;
  770. possible_error,
  771. unit_specific,
  772. again : boolean;
  773. sym : pvarsym;
  774. classh : pobjectdef;
  775. d : bestreal;
  776. static_name : string;
  777. propsym : ppropertysym;
  778. filepos : tfileposinfo;
  779. {---------------------------------------------
  780. Is_func_ret
  781. ---------------------------------------------}
  782. function is_func_ret(sym : psym) : boolean;
  783. var
  784. p : pprocinfo;
  785. storesymtablestack : psymtable;
  786. begin
  787. is_func_ret:=false;
  788. if (sym^.typ<>funcretsym) and ((procinfo.flags and pi_operator)=0) then
  789. exit;
  790. p:=@procinfo;
  791. while system.assigned(p) do
  792. begin
  793. { is this an access to a function result ? }
  794. if assigned(p^.funcretsym) and
  795. ((pfuncretsym(sym)=p^.funcretsym) or
  796. ((pvarsym(sym)=opsym) and
  797. ((p^.flags and pi_operator)<>0))) and
  798. (p^.retdef<>pdef(voiddef)) and
  799. (token<>_LKLAMMER) and
  800. (not ((m_tp in aktmodeswitches) and
  801. (afterassignment or in_args))) then
  802. begin
  803. if ((pvarsym(sym)=opsym) and
  804. ((p^.flags and pi_operator)<>0)) then
  805. inc(opsym^.refs);
  806. if ((pvarsym(sym)=opsym) and
  807. ((p^.flags and pi_operator)<>0)) then
  808. inc(opsym^.refs);
  809. p1:=genzeronode(funcretn);
  810. pd:=p^.retdef;
  811. p1^.funcretprocinfo:=p;
  812. p1^.retdef:=pd;
  813. is_func_ret:=true;
  814. exit;
  815. end;
  816. p:=p^.parent;
  817. end;
  818. { we must use the function call }
  819. if(sym^.typ=funcretsym) then
  820. begin
  821. storesymtablestack:=symtablestack;
  822. symtablestack:=srsymtable^.next;
  823. getsym(sym^.name,true);
  824. if srsym^.typ<>procsym then
  825. Message(cg_e_illegal_expression);
  826. symtablestack:=storesymtablestack;
  827. end;
  828. end;
  829. {---------------------------------------------
  830. Factor_read_id
  831. ---------------------------------------------}
  832. procedure factor_read_id;
  833. var
  834. pc : pchar;
  835. len : longint;
  836. begin
  837. { allow post fix operators }
  838. again:=true;
  839. if (m_result in aktmodeswitches) and
  840. (idtoken=_RESULT) and
  841. assigned(aktprocsym) and
  842. (procinfo.retdef<>pdef(voiddef)) then
  843. begin
  844. consume(_ID);
  845. p1:=genzeronode(funcretn);
  846. pd:=procinfo.retdef;
  847. p1^.funcretprocinfo:=pointer(@procinfo);
  848. p1^.retdef:=pd;
  849. end
  850. else
  851. begin
  852. if lastsymknown then
  853. begin
  854. srsym:=lastsrsym;
  855. srsymtable:=lastsrsymtable;
  856. lastsymknown:=false;
  857. end
  858. else
  859. getsym(pattern,true);
  860. consume(_ID);
  861. if not is_func_ret(srsym) then
  862. { else it's a normal symbol }
  863. begin
  864. { is it defined like UNIT.SYMBOL ? }
  865. if srsym^.typ=unitsym then
  866. begin
  867. consume(_POINT);
  868. getsymonlyin(punitsym(srsym)^.unitsymtable,pattern);
  869. unit_specific:=true;
  870. consume(_ID);
  871. end
  872. else
  873. unit_specific:=false;
  874. if not assigned(srsym) then
  875. Begin
  876. p1:=genzeronode(errorn);
  877. { try to clean up }
  878. pd:=generrordef;
  879. end
  880. else
  881. Begin
  882. { check semantics of private }
  883. if (srsym^.typ in [propertysym,procsym,varsym]) and
  884. (srsymtable^.symtabletype=objectsymtable) then
  885. begin
  886. if (sp_private in srsym^.symoptions) and
  887. (pobjectdef(srsym^.owner^.defowner)^.owner^.symtabletype=unitsymtable) then
  888. Message(parser_e_cant_access_private_member);
  889. end;
  890. case srsym^.typ of
  891. absolutesym : begin
  892. p1:=genloadnode(pvarsym(srsym),srsymtable);
  893. pd:=pabsolutesym(srsym)^.definition;
  894. end;
  895. varsym : begin
  896. { are we in a class method ? }
  897. if (srsymtable^.symtabletype=objectsymtable) and
  898. assigned(aktprocsym) and
  899. (po_classmethod in aktprocsym^.definition^.procoptions) then
  900. Message(parser_e_only_class_methods);
  901. if (sp_static in srsym^.symoptions) then
  902. begin
  903. static_name:=lower(srsym^.owner^.name^)+'_'+srsym^.name;
  904. getsym(static_name,true);
  905. end;
  906. p1:=genloadnode(pvarsym(srsym),srsymtable);
  907. if pvarsym(srsym)^.varstate=vs_declared then
  908. begin
  909. p1^.is_first := true;
  910. { set special between first loaded until checked in firstpass }
  911. pvarsym(srsym)^.varstate:=vs_declared2;
  912. end;
  913. pd:=pvarsym(srsym)^.definition;
  914. end;
  915. typedconstsym : begin
  916. p1:=gentypedconstloadnode(ptypedconstsym(srsym),srsymtable);
  917. pd:=ptypedconstsym(srsym)^.definition;
  918. end;
  919. syssym : p1:=statement_syssym(psyssym(srsym)^.number,pd);
  920. typesym : begin
  921. pd:=ptypesym(srsym)^.definition;
  922. if not assigned(pd) then
  923. begin
  924. pd:=generrordef;
  925. again:=false;
  926. end
  927. else
  928. begin
  929. { if we read a type declaration }
  930. { we have to return the type and }
  931. { nothing else }
  932. if block_type=bt_type then
  933. begin
  934. { we don't need sym reference when it's in the
  935. current unit or system unit, because those
  936. units are always loaded (PFV) }
  937. if (pd^.owner^.unitid=0) or
  938. (pd^.owner^.unitid=1) then
  939. p1:=gentypenode(pd,nil)
  940. else
  941. p1:=gentypenode(pd,ptypesym(srsym));
  942. { here we can also set resulttype !! }
  943. p1^.resulttype:=pd;
  944. pd:=voiddef;
  945. end
  946. else { not type block }
  947. begin
  948. if token=_LKLAMMER then
  949. begin
  950. consume(_LKLAMMER);
  951. p1:=comp_expr(true);
  952. consume(_RKLAMMER);
  953. p1:=gentypeconvnode(p1,pd);
  954. p1^.explizit:=true;
  955. end
  956. else { not LKLAMMER}
  957. if (token=_POINT) and
  958. (pd^.deftype=objectdef) and
  959. not(pobjectdef(pd)^.is_class) then
  960. begin
  961. consume(_POINT);
  962. if assigned(procinfo._class) then
  963. begin
  964. if procinfo._class^.is_related(pobjectdef(pd)) then
  965. begin
  966. p1:=gentypenode(pd,ptypesym(srsym));
  967. p1^.resulttype:=pd;
  968. srsymtable:=pobjectdef(pd)^.symtable;
  969. sym:=pvarsym(srsymtable^.search(pattern));
  970. { search also in inherited methods }
  971. while sym=nil do
  972. begin
  973. pd:=pobjectdef(pd)^.childof;
  974. srsymtable:=pobjectdef(pd)^.symtable;
  975. sym:=pvarsym(srsymtable^.search(pattern));
  976. end;
  977. consume(_ID);
  978. do_member_read(false,sym,p1,pd,again);
  979. end
  980. else
  981. begin
  982. Message(parser_e_no_super_class);
  983. pd:=generrordef;
  984. again:=false;
  985. end;
  986. end
  987. else
  988. begin
  989. { allows @TObject.Load }
  990. { also allows static methods and variables }
  991. p1:=genzeronode(typen);
  992. p1^.resulttype:=pd;
  993. { srsymtable:=pobjectdef(pd)^.symtable;
  994. sym:=pvarsym(srsymtable^.search(pattern)); }
  995. { TP allows also @TMenu.Load if Load is only }
  996. { defined in an anchestor class }
  997. sym:=pvarsym(search_class_member(pobjectdef(pd),pattern));
  998. if not assigned(sym) then
  999. Message1(sym_e_id_no_member,pattern)
  1000. else if not(getaddr) and not(sp_static in sym^.symoptions) then
  1001. Message(sym_e_only_static_in_static)
  1002. else
  1003. begin
  1004. consume(_ID);
  1005. do_member_read(getaddr,sym,p1,pd,again);
  1006. end;
  1007. end;
  1008. end
  1009. else
  1010. begin
  1011. { class reference ? }
  1012. if (pd^.deftype=objectdef)
  1013. and pobjectdef(pd)^.is_class then
  1014. begin
  1015. p1:=gentypenode(pd,nil);
  1016. p1^.resulttype:=pd;
  1017. pd:=new(pclassrefdef,init(pd));
  1018. p1:=gensinglenode(loadvmtn,p1);
  1019. p1^.resulttype:=pd;
  1020. end
  1021. else
  1022. begin
  1023. { generate a type node }
  1024. { (for typeof etc) }
  1025. if allow_type then
  1026. begin
  1027. p1:=gentypenode(pd,nil);
  1028. { here we must use typenodetype explicitly !! PM
  1029. p1^.resulttype:=pd; }
  1030. pd:=voiddef;
  1031. end
  1032. else
  1033. Message(parser_e_no_type_not_allowed_here);
  1034. end;
  1035. end;
  1036. end;
  1037. end;
  1038. end;
  1039. enumsym : begin
  1040. p1:=genenumnode(penumsym(srsym));
  1041. pd:=p1^.resulttype;
  1042. end;
  1043. constsym : begin
  1044. case pconstsym(srsym)^.consttype of
  1045. constint :
  1046. p1:=genordinalconstnode(pconstsym(srsym)^.value,s32bitdef);
  1047. conststring :
  1048. begin
  1049. len:=pconstsym(srsym)^.len;
  1050. if not(cs_ansistrings in aktlocalswitches) and (len>255) then
  1051. len:=255;
  1052. getmem(pc,len+1);
  1053. move(pchar(pconstsym(srsym)^.value)^,pc^,len);
  1054. pc[len]:=#0;
  1055. p1:=genpcharconstnode(pc,len);
  1056. end;
  1057. constchar :
  1058. p1:=genordinalconstnode(pconstsym(srsym)^.value,cchardef);
  1059. constreal :
  1060. p1:=genrealconstnode(pbestreal(pconstsym(srsym)^.value)^,bestrealdef^);
  1061. constbool :
  1062. p1:=genordinalconstnode(pconstsym(srsym)^.value,booldef);
  1063. constset :
  1064. p1:=gensetconstnode(pconstset(pconstsym(srsym)^.value),
  1065. psetdef(pconstsym(srsym)^.definition));
  1066. constord :
  1067. p1:=genordinalconstnode(pconstsym(srsym)^.value,
  1068. pconstsym(srsym)^.definition);
  1069. constnil :
  1070. p1:=genzeronode(niln);
  1071. constresourcestring:
  1072. begin
  1073. p1:=genloadnode(pvarsym(srsym),srsymtable);
  1074. p1^.resulttype:=cansistringdef;
  1075. end;
  1076. end;
  1077. pd:=p1^.resulttype;
  1078. end;
  1079. procsym : begin
  1080. { are we in a class method ? }
  1081. possible_error:=(srsymtable^.symtabletype=objectsymtable) and
  1082. assigned(aktprocsym) and
  1083. (po_classmethod in aktprocsym^.definition^.procoptions);
  1084. p1:=gencallnode(pprocsym(srsym),srsymtable);
  1085. p1^.unit_specific:=unit_specific;
  1086. do_proc_call(getaddr or
  1087. (getprocvar and
  1088. (m_tp_procvar in aktmodeswitches) and
  1089. proc_to_procvar_equal(pprocsym(srsym)^.definition,getprocvardef)),
  1090. again,p1,pd);
  1091. if possible_error and
  1092. not(po_classmethod in p1^.procdefinition^.procoptions) then
  1093. Message(parser_e_only_class_methods);
  1094. end;
  1095. propertysym : begin
  1096. { access to property in a method }
  1097. { are we in a class method ? }
  1098. if (srsymtable^.symtabletype=objectsymtable) and
  1099. assigned(aktprocsym) and
  1100. (po_classmethod in aktprocsym^.definition^.procoptions) then
  1101. Message(parser_e_only_class_methods);
  1102. { no method pointer }
  1103. p1:=nil;
  1104. handle_propertysym(srsym,srsymtable,p1,pd);
  1105. end;
  1106. errorsym : begin
  1107. p1:=genzeronode(errorn);
  1108. p1^.resulttype:=generrordef;
  1109. pd:=generrordef;
  1110. if token=_LKLAMMER then
  1111. begin
  1112. consume(_LKLAMMER);
  1113. parse_paras(false,false);
  1114. consume(_RKLAMMER);
  1115. end;
  1116. end;
  1117. else
  1118. begin
  1119. p1:=genzeronode(errorn);
  1120. pd:=generrordef;
  1121. Message(cg_e_illegal_expression);
  1122. end;
  1123. end; { end case }
  1124. end;
  1125. end;
  1126. end;
  1127. end;
  1128. {---------------------------------------------
  1129. Factor_Read_Set
  1130. ---------------------------------------------}
  1131. { Read a set between [] }
  1132. function factor_read_set:ptree;
  1133. var
  1134. p1,
  1135. lastp,
  1136. buildp : ptree;
  1137. begin
  1138. buildp:=nil;
  1139. { be sure that a least one arrayconstructn is used, also for an
  1140. empty [] }
  1141. if token=_RECKKLAMMER then
  1142. buildp:=gennode(arrayconstructn,nil,buildp)
  1143. else
  1144. begin
  1145. while true do
  1146. begin
  1147. p1:=comp_expr(true);
  1148. if token=_POINTPOINT then
  1149. begin
  1150. consume(_POINTPOINT);
  1151. p2:=comp_expr(true);
  1152. p1:=gennode(arrayconstructrangen,p1,p2);
  1153. end;
  1154. { insert at the end of the tree, to get the correct order }
  1155. if not assigned(buildp) then
  1156. begin
  1157. buildp:=gennode(arrayconstructn,p1,nil);
  1158. lastp:=buildp;
  1159. end
  1160. else
  1161. begin
  1162. lastp^.right:=gennode(arrayconstructn,p1,nil);
  1163. lastp:=lastp^.right;
  1164. end;
  1165. { there could be more elements }
  1166. if token=_COMMA then
  1167. consume(_COMMA)
  1168. else
  1169. break;
  1170. end;
  1171. end;
  1172. factor_read_set:=buildp;
  1173. end;
  1174. {---------------------------------------------
  1175. Helpers
  1176. ---------------------------------------------}
  1177. procedure check_tokenpos;
  1178. begin
  1179. if (p1<>oldp1) then
  1180. begin
  1181. if assigned(p1) then
  1182. set_tree_filepos(p1,filepos);
  1183. oldp1:=p1;
  1184. filepos:=tokenpos;
  1185. end;
  1186. end;
  1187. {---------------------------------------------
  1188. PostFixOperators
  1189. ---------------------------------------------}
  1190. procedure postfixoperators;
  1191. var
  1192. store_static : boolean;
  1193. { p1 and p2 must contain valid value_str }
  1194. begin
  1195. check_tokenpos;
  1196. while again do
  1197. begin
  1198. { prevent crashes with unknown types }
  1199. if not assigned(pd) then
  1200. begin
  1201. { try to recover }
  1202. repeat
  1203. case token of
  1204. _CARET:
  1205. consume(_CARET);
  1206. _POINT:
  1207. begin
  1208. consume(_POINT);
  1209. consume(_ID);
  1210. end;
  1211. _LECKKLAMMER:
  1212. begin
  1213. repeat
  1214. consume(token);
  1215. until token in [_RECKKLAMMER,_SEMICOLON];
  1216. end;
  1217. else
  1218. break;
  1219. end;
  1220. until false;
  1221. exit;
  1222. end;
  1223. { handle token }
  1224. case token of
  1225. _CARET:
  1226. begin
  1227. consume(_CARET);
  1228. if (pd^.deftype<>pointerdef) then
  1229. begin
  1230. { ^ as binary operator is a problem!!!! (FK) }
  1231. again:=false;
  1232. Message(cg_e_invalid_qualifier);
  1233. disposetree(p1);
  1234. p1:=genzeronode(errorn);
  1235. end
  1236. else
  1237. begin
  1238. p1:=gensinglenode(derefn,p1);
  1239. pd:=ppointerdef(pd)^.definition;
  1240. end;
  1241. end;
  1242. _LECKKLAMMER:
  1243. begin
  1244. if (pd^.deftype=objectdef) and pobjectdef(pd)^.is_class then
  1245. begin
  1246. { default property }
  1247. propsym:=search_default_property(pobjectdef(pd));
  1248. if not(assigned(propsym)) then
  1249. begin
  1250. disposetree(p1);
  1251. p1:=genzeronode(errorn);
  1252. again:=false;
  1253. message(parser_e_no_default_property_available);
  1254. end
  1255. else
  1256. handle_propertysym(propsym,propsym^.owner,p1,pd);
  1257. end
  1258. else
  1259. begin
  1260. consume(_LECKKLAMMER);
  1261. repeat
  1262. case pd^.deftype of
  1263. pointerdef:
  1264. begin
  1265. p2:=comp_expr(true);
  1266. p1:=gennode(vecn,p1,p2);
  1267. pd:=ppointerdef(pd)^.definition;
  1268. end;
  1269. stringdef : begin
  1270. p2:=comp_expr(true);
  1271. p1:=gennode(vecn,p1,p2);
  1272. pd:=cchardef
  1273. end;
  1274. arraydef : begin
  1275. p2:=comp_expr(true);
  1276. { support SEG:OFS for go32v2 Mem[] }
  1277. if (target_info.target=target_i386_go32v2) and
  1278. (p1^.treetype=loadn) and
  1279. assigned(p1^.symtableentry) and
  1280. assigned(p1^.symtableentry^.owner^.name) and
  1281. (p1^.symtableentry^.owner^.name^='SYSTEM') and
  1282. ((p1^.symtableentry^.name='MEM') or
  1283. (p1^.symtableentry^.name='MEMW') or
  1284. (p1^.symtableentry^.name='MEML')) then
  1285. begin
  1286. if (token=_COLON) then
  1287. begin
  1288. consume(_COLON);
  1289. p3:=gennode(muln,genordinalconstnode($10,s32bitdef),p2);
  1290. p2:=comp_expr(true);
  1291. p2:=gennode(addn,p2,p3);
  1292. p1:=gennode(vecn,p1,p2);
  1293. p1^.memseg:=true;
  1294. p1^.memindex:=true;
  1295. end
  1296. else
  1297. begin
  1298. p1:=gennode(vecn,p1,p2);
  1299. p1^.memindex:=true;
  1300. end;
  1301. end
  1302. else
  1303. p1:=gennode(vecn,p1,p2);
  1304. pd:=parraydef(pd)^.definition;
  1305. end;
  1306. else
  1307. begin
  1308. Message(cg_e_invalid_qualifier);
  1309. disposetree(p1);
  1310. p1:=genzeronode(errorn);
  1311. again:=false;
  1312. end;
  1313. end;
  1314. if token=_COMMA then
  1315. consume(_COMMA)
  1316. else
  1317. break;
  1318. until false;
  1319. consume(_RECKKLAMMER);
  1320. end;
  1321. end;
  1322. _POINT : begin
  1323. consume(_POINT);
  1324. if (pd^.deftype=pointerdef) and
  1325. (m_autoderef in aktmodeswitches) then
  1326. begin
  1327. p1:=gensinglenode(derefn,p1);
  1328. pd:=ppointerdef(pd)^.definition;
  1329. end;
  1330. case pd^.deftype of
  1331. recorddef:
  1332. begin
  1333. sym:=pvarsym(precorddef(pd)^.symtable^.search(pattern));
  1334. if sym=nil then
  1335. begin
  1336. Message1(sym_e_illegal_field,pattern);
  1337. disposetree(p1);
  1338. p1:=genzeronode(errorn);
  1339. end
  1340. else
  1341. begin
  1342. p1:=gensubscriptnode(sym,p1);
  1343. pd:=sym^.definition;
  1344. end;
  1345. consume(_ID);
  1346. end;
  1347. classrefdef:
  1348. begin
  1349. classh:=pobjectdef(pclassrefdef(pd)^.definition);
  1350. sym:=nil;
  1351. while assigned(classh) do
  1352. begin
  1353. sym:=pvarsym(classh^.symtable^.search(pattern));
  1354. srsymtable:=classh^.symtable;
  1355. if assigned(sym) then
  1356. break;
  1357. classh:=classh^.childof;
  1358. end;
  1359. consume(_ID);
  1360. do_member_read(getaddr,sym,p1,pd,again);
  1361. end;
  1362. objectdef:
  1363. begin
  1364. classh:=pobjectdef(pd);
  1365. sym:=nil;
  1366. store_static:=allow_only_static;
  1367. allow_only_static:=false;
  1368. while assigned(classh) do
  1369. begin
  1370. sym:=pvarsym(classh^.symtable^.search(pattern));
  1371. srsymtable:=classh^.symtable;
  1372. if assigned(sym) then
  1373. break;
  1374. classh:=classh^.childof;
  1375. end;
  1376. allow_only_static:=store_static;
  1377. consume(_ID);
  1378. do_member_read(getaddr,sym,p1,pd,again);
  1379. end;
  1380. pointerdef:
  1381. begin
  1382. Message(cg_e_invalid_qualifier);
  1383. if ppointerdef(pd)^.definition^.deftype in [recorddef,objectdef,classrefdef] then
  1384. Message(parser_h_maybe_deref_caret_missing);
  1385. end;
  1386. else
  1387. begin
  1388. Message(cg_e_invalid_qualifier);
  1389. disposetree(p1);
  1390. p1:=genzeronode(errorn);
  1391. end;
  1392. end;
  1393. end;
  1394. else
  1395. begin
  1396. { is this a procedure variable ? }
  1397. if assigned(pd) then
  1398. begin
  1399. if (pd^.deftype=procvardef) then
  1400. begin
  1401. if getprocvar and is_equal(pd,getprocvardef) then
  1402. again:=false
  1403. else
  1404. if (token=_LKLAMMER) or
  1405. ((pprocvardef(pd)^.para1=nil) and
  1406. (not((token in [_ASSIGNMENT,_UNEQUAL,_EQUAL]))) and
  1407. (not afterassignment) and
  1408. (not in_args)) then
  1409. begin
  1410. { do this in a strange way }
  1411. { it's not a clean solution }
  1412. p2:=p1;
  1413. p1:=gencallnode(nil,nil);
  1414. p1^.right:=p2;
  1415. p1^.unit_specific:=unit_specific;
  1416. p1^.symtableprocentry:=pprocsym(sym);
  1417. if token=_LKLAMMER then
  1418. begin
  1419. consume(_LKLAMMER);
  1420. p1^.left:=parse_paras(false,false);
  1421. consume(_RKLAMMER);
  1422. end;
  1423. pd:=pprocvardef(pd)^.retdef;
  1424. { proc():= is never possible }
  1425. if token=_ASSIGNMENT then
  1426. begin
  1427. Message(cg_e_illegal_expression);
  1428. p1:=genzeronode(errorn);
  1429. again:=false;
  1430. end;
  1431. p1^.resulttype:=pd;
  1432. end
  1433. else
  1434. again:=false;
  1435. p1^.resulttype:=pd;
  1436. end
  1437. else
  1438. again:=false;
  1439. end
  1440. else
  1441. again:=false;
  1442. end;
  1443. end;
  1444. check_tokenpos;
  1445. end; { while again }
  1446. end;
  1447. {---------------------------------------------
  1448. Factor (Main)
  1449. ---------------------------------------------}
  1450. begin
  1451. oldp1:=nil;
  1452. p1:=nil;
  1453. filepos:=tokenpos;
  1454. if token=_ID then
  1455. begin
  1456. factor_read_id;
  1457. { handle post fix operators }
  1458. postfixoperators;
  1459. end
  1460. else
  1461. case token of
  1462. _NEW : begin
  1463. consume(_NEW);
  1464. consume(_LKLAMMER);
  1465. {allow_type:=true;}
  1466. p1:=factor(false);
  1467. {allow_type:=false;}
  1468. if p1^.treetype<>typen then
  1469. begin
  1470. Message(type_e_type_id_expected);
  1471. disposetree(p1);
  1472. pd:=generrordef;
  1473. end
  1474. else
  1475. pd:=p1^.typenodetype;
  1476. pd2:=pd;
  1477. if (pd^.deftype<>pointerdef) then
  1478. Message1(type_e_pointer_type_expected,pd^.typename)
  1479. else if {(ppointerdef(pd)^.definition^.deftype<>objectdef)}
  1480. token=_RKLAMMER then
  1481. begin
  1482. if (ppointerdef(pd)^.definition^.deftype=objectdef) and
  1483. (oo_has_vmt in pobjectdef(ppointerdef(pd)^.definition)^.objectoptions) then
  1484. Message(parser_w_use_extended_syntax_for_objects);
  1485. p1:=gensinglenode(newn,nil);
  1486. p1^.resulttype:=pd2;
  1487. consume(_RKLAMMER);
  1488. (*Message(parser_e_pointer_to_class_expected);
  1489. { if an error occurs, read til the end of
  1490. the new statement }
  1491. p1:=genzeronode(errorn);
  1492. l:=1;
  1493. while true do
  1494. begin
  1495. case token of
  1496. _LKLAMMER : inc(l);
  1497. _RKLAMMER : dec(l);
  1498. end;
  1499. consume(token);
  1500. if l=0 then
  1501. break;
  1502. end;*)
  1503. end
  1504. else
  1505. begin
  1506. disposetree(p1);
  1507. p1:=genzeronode(hnewn);
  1508. p1^.resulttype:=ppointerdef(pd)^.definition;
  1509. consume(_COMMA);
  1510. afterassignment:=false;
  1511. { determines the current object defintion }
  1512. classh:=pobjectdef(ppointerdef(pd)^.definition);
  1513. { check for an abstract class }
  1514. if (oo_has_abstract in classh^.objectoptions) then
  1515. Message(sym_e_no_instance_of_abstract_object);
  1516. { search the constructor also in the symbol tables of
  1517. the parents }
  1518. { no constructor found }
  1519. sym:=nil;
  1520. while assigned(classh) do
  1521. begin
  1522. sym:=pvarsym(classh^.symtable^.search(pattern));
  1523. srsymtable:=classh^.symtable;
  1524. if assigned(sym) then
  1525. break;
  1526. classh:=classh^.childof;
  1527. end;
  1528. consume(_ID);
  1529. do_member_read(false,sym,p1,pd,again);
  1530. if (p1^.treetype<>calln) or
  1531. (assigned(p1^.procdefinition) and
  1532. (p1^.procdefinition^.proctypeoption<>potype_constructor)) then
  1533. Message(parser_e_expr_have_to_be_constructor_call);
  1534. p1:=gensinglenode(newn,p1);
  1535. { set the resulttype }
  1536. p1^.resulttype:=pd2;
  1537. consume(_RKLAMMER);
  1538. end;
  1539. postfixoperators;
  1540. end;
  1541. _SELF : begin
  1542. again:=true;
  1543. consume(_SELF);
  1544. if not assigned(procinfo._class) then
  1545. begin
  1546. p1:=genzeronode(errorn);
  1547. pd:=generrordef;
  1548. again:=false;
  1549. Message(parser_e_self_not_in_method);
  1550. end
  1551. else
  1552. begin
  1553. if (po_classmethod in aktprocsym^.definition^.procoptions) then
  1554. begin
  1555. { self in class methods is a class reference type }
  1556. pd:=new(pclassrefdef,init(procinfo._class));
  1557. p1:=genselfnode(pd);
  1558. p1^.resulttype:=pd;
  1559. end
  1560. else
  1561. begin
  1562. p1:=genselfnode(procinfo._class);
  1563. p1^.resulttype:=procinfo._class;
  1564. end;
  1565. pd:=p1^.resulttype;
  1566. postfixoperators;
  1567. end;
  1568. end;
  1569. _INHERITED : begin
  1570. again:=true;
  1571. consume(_INHERITED);
  1572. if assigned(procinfo._class) then
  1573. begin
  1574. classh:=procinfo._class^.childof;
  1575. while assigned(classh) do
  1576. begin
  1577. srsymtable:=pobjectdef(classh)^.symtable;
  1578. sym:=pvarsym(srsymtable^.search(pattern));
  1579. if assigned(sym) then
  1580. begin
  1581. p1:=genzeronode(typen);
  1582. p1^.resulttype:=classh;
  1583. pd:=p1^.resulttype;
  1584. consume(_ID);
  1585. do_member_read(false,sym,p1,pd,again);
  1586. break;
  1587. end;
  1588. classh:=classh^.childof;
  1589. end;
  1590. if classh=nil then
  1591. begin
  1592. Message1(sym_e_id_no_member,pattern);
  1593. again:=false;
  1594. pd:=generrordef;
  1595. p1:=genzeronode(errorn);
  1596. end;
  1597. end
  1598. else
  1599. begin
  1600. Message(parser_e_generic_methods_only_in_methods);
  1601. again:=false;
  1602. pd:=generrordef;
  1603. p1:=genzeronode(errorn);
  1604. end;
  1605. postfixoperators;
  1606. end;
  1607. _INTCONST : begin
  1608. valint(pattern,l,code);
  1609. if code<>0 then
  1610. begin
  1611. val(pattern,d,code);
  1612. if code<>0 then
  1613. begin
  1614. Message(cg_e_invalid_integer);
  1615. consume(_INTCONST);
  1616. l:=1;
  1617. p1:=genordinalconstnode(l,s32bitdef);
  1618. end
  1619. else
  1620. begin
  1621. consume(_INTCONST);
  1622. p1:=genrealconstnode(d,bestrealdef^);
  1623. end;
  1624. end
  1625. else
  1626. begin
  1627. consume(_INTCONST);
  1628. p1:=genordinalconstnode(l,s32bitdef);
  1629. end;
  1630. end;
  1631. _REALNUMBER : begin
  1632. val(pattern,d,code);
  1633. if code<>0 then
  1634. begin
  1635. Message(parser_e_error_in_real);
  1636. d:=1.0;
  1637. end;
  1638. consume(_REALNUMBER);
  1639. p1:=genrealconstnode(d,bestrealdef^);
  1640. end;
  1641. _STRING : begin
  1642. pd:=stringtype;
  1643. { STRING can be also a type cast }
  1644. if token=_LKLAMMER then
  1645. begin
  1646. consume(_LKLAMMER);
  1647. p1:=comp_expr(true);
  1648. consume(_RKLAMMER);
  1649. p1:=gentypeconvnode(p1,pd);
  1650. p1^.explizit:=true;
  1651. { handle postfix operators here e.g. string(a)[10] }
  1652. again:=true;
  1653. postfixoperators;
  1654. end
  1655. else
  1656. p1:=gentypenode(pd,nil);
  1657. end;
  1658. _FILE : begin
  1659. pd:=cfiledef;
  1660. consume(_FILE);
  1661. { FILE can be also a type cast }
  1662. if token=_LKLAMMER then
  1663. begin
  1664. consume(_LKLAMMER);
  1665. p1:=comp_expr(true);
  1666. consume(_RKLAMMER);
  1667. p1:=gentypeconvnode(p1,pd);
  1668. p1^.explizit:=true;
  1669. { handle postfix operators here e.g. string(a)[10] }
  1670. again:=true;
  1671. postfixoperators;
  1672. end
  1673. else
  1674. p1:=gentypenode(pd,nil);
  1675. end;
  1676. _CSTRING : begin
  1677. p1:=genstringconstnode(pattern);
  1678. consume(_CSTRING);
  1679. end;
  1680. _CCHAR : begin
  1681. p1:=genordinalconstnode(ord(pattern[1]),cchardef);
  1682. consume(_CCHAR);
  1683. end;
  1684. _KLAMMERAFFE : begin
  1685. consume(_KLAMMERAFFE);
  1686. got_addrn:=true;
  1687. p1:=factor(true);
  1688. got_addrn:=false;
  1689. p1:=gensinglenode(addrn,p1);
  1690. end;
  1691. _LKLAMMER : begin
  1692. consume(_LKLAMMER);
  1693. p1:=comp_expr(true);
  1694. consume(_RKLAMMER);
  1695. { it's not a good solution }
  1696. { but (a+b)^ makes some problems }
  1697. if token in [_CARET,_POINT,_LECKKLAMMER] then
  1698. begin
  1699. { we need the resulttype }
  1700. { of the expression in pd }
  1701. do_firstpass(p1);
  1702. pd:=p1^.resulttype;
  1703. again:=true;
  1704. postfixoperators;
  1705. end;
  1706. end;
  1707. _LECKKLAMMER : begin
  1708. consume(_LECKKLAMMER);
  1709. p1:=factor_read_set;
  1710. consume(_RECKKLAMMER);
  1711. end;
  1712. _PLUS : begin
  1713. consume(_PLUS);
  1714. p1:=factor(false);
  1715. end;
  1716. _MINUS : begin
  1717. consume(_MINUS);
  1718. p1:=factor(false);
  1719. p1:=gensinglenode(umminusn,p1);
  1720. end;
  1721. _NOT : begin
  1722. consume(_NOT);
  1723. p1:=factor(false);
  1724. p1:=gensinglenode(notn,p1);
  1725. end;
  1726. _TRUE : begin
  1727. consume(_TRUE);
  1728. p1:=genordinalconstnode(1,booldef);
  1729. end;
  1730. _FALSE : begin
  1731. consume(_FALSE);
  1732. p1:=genordinalconstnode(0,booldef);
  1733. end;
  1734. _NIL : begin
  1735. consume(_NIL);
  1736. p1:=genzeronode(niln);
  1737. end;
  1738. else
  1739. begin
  1740. p1:=genzeronode(errorn);
  1741. consume(token);
  1742. Message(cg_e_illegal_expression);
  1743. end;
  1744. end;
  1745. { generate error node if no node is created }
  1746. if not assigned(p1) then
  1747. p1:=genzeronode(errorn);
  1748. { tp7 procvar handling, but not if the next token
  1749. will be a := }
  1750. if (m_tp_procvar in aktmodeswitches) and
  1751. (token<>_ASSIGNMENT) then
  1752. check_tp_procvar(p1);
  1753. factor:=p1;
  1754. check_tokenpos;
  1755. end;
  1756. {****************************************************************************
  1757. Sub_Expr
  1758. ****************************************************************************}
  1759. type
  1760. Toperator_precedence=(opcompare,opaddition,opmultiply);
  1761. Ttok2nodeRec=record
  1762. tok : ttoken;
  1763. nod : ttreetyp;
  1764. end;
  1765. const
  1766. tok2nodes=23;
  1767. tok2node:array[1..tok2nodes] of ttok2noderec=(
  1768. (tok:_PLUS ;nod:addn),
  1769. (tok:_MINUS ;nod:subn),
  1770. (tok:_STAR ;nod:muln),
  1771. (tok:_SLASH ;nod:slashn),
  1772. (tok:_EQUAL ;nod:equaln),
  1773. (tok:_GT ;nod:gtn),
  1774. (tok:_LT ;nod:ltn),
  1775. (tok:_GTE ;nod:gten),
  1776. (tok:_LTE ;nod:lten),
  1777. (tok:_SYMDIF ;nod:symdifn),
  1778. (tok:_STARSTAR;nod:starstarn),
  1779. (tok:_CARET ;nod:caretn),
  1780. (tok:_UNEQUAL ;nod:unequaln),
  1781. (tok:_AS ;nod:asn),
  1782. (tok:_IN ;nod:inn),
  1783. (tok:_IS ;nod:isn),
  1784. (tok:_OR ;nod:orn),
  1785. (tok:_AND ;nod:andn),
  1786. (tok:_DIV ;nod:divn),
  1787. (tok:_MOD ;nod:modn),
  1788. (tok:_SHL ;nod:shln),
  1789. (tok:_SHR ;nod:shrn),
  1790. (tok:_XOR ;nod:xorn)
  1791. );
  1792. operator_levels:array[Toperator_precedence] of set of Ttoken=
  1793. ([_LT,_LTE,_GT,_GTE,_EQUAL,_UNEQUAL,_IN,_IS],
  1794. [_PLUS,_MINUS,_OR,_XOR],
  1795. [_CARET,_SYMDIF,_STARSTAR,_STAR,_SLASH,_DIV,_MOD,_AND,_SHL,_SHR,_AS]);
  1796. function sub_expr(pred_level:Toperator_precedence;accept_equal : boolean):Ptree;
  1797. {Reads a subexpression while the operators are of the current precedence
  1798. level, or any higher level. Replaces the old term, simpl_expr and
  1799. simpl2_expr.}
  1800. var
  1801. low,high,mid : longint;
  1802. p1,p2 : Ptree;
  1803. oldt : Ttoken;
  1804. filepos : tfileposinfo;
  1805. begin
  1806. if pred_level=opmultiply then
  1807. p1:=factor(false)
  1808. else
  1809. p1:=sub_expr(succ(pred_level),true);
  1810. repeat
  1811. if (token in operator_levels[pred_level]) and
  1812. ((token<>_EQUAL) or accept_equal) then
  1813. begin
  1814. oldt:=token;
  1815. filepos:=tokenpos;
  1816. consume(token);
  1817. if pred_level=opmultiply then
  1818. p2:=factor(false)
  1819. else
  1820. p2:=sub_expr(succ(pred_level),true);
  1821. low:=1;
  1822. high:=tok2nodes;
  1823. while (low<high) do
  1824. begin
  1825. mid:=(low+high+1) shr 1;
  1826. if oldt<tok2node[mid].tok then
  1827. high:=mid-1
  1828. else
  1829. low:=mid;
  1830. end;
  1831. if tok2node[high].tok=oldt then
  1832. p1:=gennode(tok2node[high].nod,p1,p2)
  1833. else
  1834. p1:=gennode(nothingn,p1,p2);
  1835. set_tree_filepos(p1,filepos);
  1836. end
  1837. else
  1838. break;
  1839. until false;
  1840. sub_expr:=p1;
  1841. end;
  1842. function comp_expr(accept_equal : boolean):Ptree;
  1843. var
  1844. oldafterassignment : boolean;
  1845. p1 : ptree;
  1846. begin
  1847. oldafterassignment:=afterassignment;
  1848. afterassignment:=true;
  1849. p1:=sub_expr(opcompare,accept_equal);
  1850. afterassignment:=oldafterassignment;
  1851. comp_expr:=p1;
  1852. end;
  1853. function expr : ptree;
  1854. var
  1855. p1,p2 : ptree;
  1856. oldafterassignment : boolean;
  1857. oldp1 : ptree;
  1858. filepos : tfileposinfo;
  1859. begin
  1860. oldafterassignment:=afterassignment;
  1861. p1:=sub_expr(opcompare,true);
  1862. filepos:=tokenpos;
  1863. if (m_tp_procvar in aktmodeswitches) and
  1864. (token<>_ASSIGNMENT) then
  1865. check_tp_procvar(p1);
  1866. if token in [_ASSIGNMENT,_PLUSASN,_MINUSASN,_STARASN,_SLASHASN] then
  1867. afterassignment:=true;
  1868. oldp1:=p1;
  1869. case token of
  1870. _POINTPOINT : begin
  1871. consume(_POINTPOINT);
  1872. p2:=sub_expr(opcompare,true);
  1873. p1:=gennode(rangen,p1,p2);
  1874. end;
  1875. _ASSIGNMENT : begin
  1876. consume(_ASSIGNMENT);
  1877. { avoid a firstpass of a procedure if
  1878. it must be assigned to a procvar }
  1879. { should be recursive for a:=b:=c !!! }
  1880. if (p1^.resulttype<>nil) and (p1^.resulttype^.deftype=procvardef) then
  1881. begin
  1882. getprocvar:=true;
  1883. getprocvardef:=pprocvardef(p1^.resulttype);
  1884. end;
  1885. p2:=sub_expr(opcompare,true);
  1886. if getprocvar then
  1887. begin
  1888. if (p2^.treetype=calln) then
  1889. handle_procvar(getprocvardef,p2)
  1890. else
  1891. { also allow p:= proc(t); !! (PM) }
  1892. if (p2^.treetype=typeconvn) and
  1893. (p2^.left^.treetype=calln) then
  1894. handle_procvar(getprocvardef,p2^.left);
  1895. end;
  1896. getprocvar:=false;
  1897. p1:=gennode(assignn,p1,p2);
  1898. end;
  1899. { this is the code for C like assignements }
  1900. { from an improvement of Peter Schaefer }
  1901. _PLUSASN : begin
  1902. consume(_PLUSASN );
  1903. p2:=sub_expr(opcompare,true);
  1904. p1:=gennode(assignn,p1,gennode(addn,getcopy(p1),p2));
  1905. { was first
  1906. p1:=gennode(assignn,p1,gennode(addn,p1,p2));
  1907. but disposetree assumes that we have a real
  1908. *** tree *** }
  1909. end;
  1910. _MINUSASN : begin
  1911. consume(_MINUSASN );
  1912. p2:=sub_expr(opcompare,true);
  1913. p1:=gennode(assignn,p1,gennode(subn,getcopy(p1),p2));
  1914. end;
  1915. _STARASN : begin
  1916. consume(_STARASN );
  1917. p2:=sub_expr(opcompare,true);
  1918. p1:=gennode(assignn,p1,gennode(muln,getcopy(p1),p2));
  1919. end;
  1920. _SLASHASN : begin
  1921. consume(_SLASHASN );
  1922. p2:=sub_expr(opcompare,true);
  1923. p1:=gennode(assignn,p1,gennode(slashn,getcopy(p1),p2));
  1924. end;
  1925. end;
  1926. afterassignment:=oldafterassignment;
  1927. if p1<>oldp1 then
  1928. set_tree_filepos(p1,filepos);
  1929. expr:=p1;
  1930. end;
  1931. function get_intconst:longint;
  1932. {Reads an expression, tries to evalute it and check if it is an integer
  1933. constant. Then the constant is returned.}
  1934. var
  1935. p:Ptree;
  1936. begin
  1937. p:=comp_expr(true);
  1938. do_firstpass(p);
  1939. if not codegenerror then
  1940. begin
  1941. if (p^.treetype<>ordconstn) and
  1942. (p^.resulttype^.deftype=orddef) and
  1943. not(Porddef(p^.resulttype)^.typ in [uvoid,uchar,bool8bit,bool16bit,bool32bit]) then
  1944. Message(cg_e_illegal_expression)
  1945. else
  1946. get_intconst:=p^.value;
  1947. end;
  1948. disposetree(p);
  1949. end;
  1950. function get_stringconst:string;
  1951. {Reads an expression, tries to evaluate it and checks if it is a string
  1952. constant. Then the constant is returned.}
  1953. var
  1954. p:Ptree;
  1955. begin
  1956. get_stringconst:='';
  1957. p:=comp_expr(true);
  1958. do_firstpass(p);
  1959. if p^.treetype<>stringconstn then
  1960. begin
  1961. if (p^.treetype=ordconstn) and is_char(p^.resulttype) then
  1962. get_stringconst:=char(p^.value)
  1963. else
  1964. Message(cg_e_illegal_expression);
  1965. end
  1966. else
  1967. get_stringconst:=strpas(p^.value_str);
  1968. disposetree(p);
  1969. end;
  1970. end.
  1971. {
  1972. $Log$
  1973. Revision 1.136 1999-08-15 22:47:45 peter
  1974. * fixed property writeaccess which was buggy after my previous
  1975. subscribed property access
  1976. Revision 1.135 1999/08/14 00:38:56 peter
  1977. * hack to support property with record fields
  1978. Revision 1.134 1999/08/09 22:16:29 peter
  1979. * fixed crash after wrong para's with class contrustor
  1980. Revision 1.133 1999/08/05 16:53:04 peter
  1981. * V_Fatal=1, all other V_ are also increased
  1982. * Check for local procedure when assigning procvar
  1983. * fixed comment parsing because directives
  1984. * oldtp mode directives better supported
  1985. * added some messages to errore.msg
  1986. Revision 1.132 1999/08/04 13:49:45 florian
  1987. * new(...)^. is now allowed
  1988. Revision 1.131 1999/08/04 13:02:55 jonas
  1989. * all tokens now start with an underscore
  1990. * PowerPC compiles!!
  1991. Revision 1.130 1999/08/04 00:23:12 florian
  1992. * renamed i386asm and i386base to cpuasm and cpubase
  1993. Revision 1.129 1999/08/03 22:02:59 peter
  1994. * moved bitmask constants to sets
  1995. * some other type/const renamings
  1996. Revision 1.128 1999/08/03 13:50:17 michael
  1997. + Changes for alpha
  1998. Revision 1.127 1999/08/01 18:28:13 florian
  1999. * modifications for the new code generator
  2000. Revision 1.126 1999/07/30 12:28:40 peter
  2001. * fixed crash with unknown id and colon parameter in write
  2002. Revision 1.125 1999/07/27 23:42:14 peter
  2003. * indirect type referencing is now allowed
  2004. Revision 1.124 1999/07/23 21:31:42 peter
  2005. * fixed crash with resourcestring
  2006. Revision 1.123 1999/07/23 11:37:46 peter
  2007. * error for illegal type reference, instead of 10998
  2008. Revision 1.122 1999/07/22 09:37:52 florian
  2009. + resourcestring implemented
  2010. + start of longstring support
  2011. Revision 1.121 1999/07/16 10:04:35 peter
  2012. * merged
  2013. Revision 1.120 1999/07/06 22:38:11 florian
  2014. * another fix for TP/Delphi styled procedure variables
  2015. Revision 1.119 1999/07/05 20:13:16 peter
  2016. * removed temp defines
  2017. Revision 1.118 1999/07/01 21:33:57 peter
  2018. * merged
  2019. Revision 1.117 1999/06/30 15:43:20 florian
  2020. * two bugs regarding method variables fixed
  2021. - if you take in a method the address of another method
  2022. don't need self anymore
  2023. - if the class pointer was in a register, wrong code for a method
  2024. variable load was generated
  2025. Revision 1.116 1999/06/26 00:24:53 pierre
  2026. * mereg from fixes-0_99_12 branch
  2027. Revision 1.112.2.8 1999/07/16 09:54:57 peter
  2028. * @procvar support in tp7 mode works again
  2029. Revision 1.112.2.7 1999/07/07 07:53:10 michael
  2030. + Merged patches from florian
  2031. Revision 1.112.2.6 1999/07/01 21:31:59 peter
  2032. * procvar fixes again
  2033. Revision 1.112.2.5 1999/07/01 15:17:17 peter
  2034. * methoidpointer fixes from florian
  2035. Revision 1.112.2.4 1999/06/26 00:22:30 pierre
  2036. * wrong warnings in -So mode suppressed
  2037. Revision 1.112.2.3 1999/06/17 12:51:44 pierre
  2038. * changed is_assignment_overloaded into
  2039. function assignment_overloaded : pprocdef
  2040. to allow overloading of assignment with only different result type
  2041. Revision 1.112.2.2 1999/06/15 18:54:52 peter
  2042. * more procvar fixes
  2043. Revision 1.112.2.1 1999/06/13 22:38:09 peter
  2044. * tp_procvar check for loading of procvars when getaddr=false
  2045. Revision 1.112 1999/06/02 22:44:11 pierre
  2046. * previous wrong log corrected
  2047. Revision 1.111 1999/06/02 22:25:43 pierre
  2048. * changed $ifdef FPC @ into $ifndef TP
  2049. * changes for correct procvar handling under tp mode
  2050. Revision 1.110 1999/06/01 19:27:55 peter
  2051. * better checks for procvar and methodpointer
  2052. Revision 1.109 1999/05/27 19:44:46 peter
  2053. * removed oldasm
  2054. * plabel -> pasmlabel
  2055. * -a switches to source writing automaticly
  2056. * assembler readers OOPed
  2057. * asmsymbol automaticly external
  2058. * jumptables and other label fixes for asm readers
  2059. Revision 1.108 1999/05/18 14:15:54 peter
  2060. * containsself fixes
  2061. * checktypes()
  2062. Revision 1.107 1999/05/18 09:52:18 peter
  2063. * procedure of object and addrn fixes
  2064. Revision 1.106 1999/05/16 17:06:31 peter
  2065. * remove firstcallparan which looks obsolete
  2066. Revision 1.105 1999/05/12 22:36:09 florian
  2067. * override isn't allowed in objects!
  2068. Revision 1.104 1999/05/07 10:35:23 florian
  2069. * first fix for a problem with method pointer properties, still doesn't work
  2070. with WITH
  2071. Revision 1.103 1999/05/06 21:40:16 peter
  2072. * fixed crash
  2073. Revision 1.101 1999/05/06 09:05:21 peter
  2074. * generic write_float and str_float
  2075. * fixed constant float conversions
  2076. Revision 1.100 1999/05/04 21:44:57 florian
  2077. * changes to compile it with Delphi 4.0
  2078. Revision 1.99 1999/05/01 13:24:31 peter
  2079. * merged nasm compiler
  2080. * old asm moved to oldasm/
  2081. Revision 1.98 1999/04/26 18:29:56 peter
  2082. * farpointerdef moved into pointerdef.is_far
  2083. Revision 1.97 1999/04/19 09:27:48 peter
  2084. * removed my property fix
  2085. Revision 1.96 1999/04/19 09:13:47 peter
  2086. * class property without write support
  2087. Revision 1.95 1999/04/19 06:10:08 florian
  2088. * property problem fixed: a propertysym is only a write
  2089. access if it is followed by a assignment token
  2090. Revision 1.94 1999/04/17 13:12:17 peter
  2091. * addr() internal
  2092. Revision 1.93 1999/04/15 09:00:08 peter
  2093. * fixed property write
  2094. Revision 1.92 1999/04/08 20:59:43 florian
  2095. * fixed problem with default properties which are a class
  2096. * case bug (from the mailing list with -O2) fixed, the
  2097. distance of the case labels can be greater than the positive
  2098. range of a longint => it is now a dword for fpc
  2099. Revision 1.91 1999/04/06 11:21:56 peter
  2100. * more use of ttoken
  2101. Revision 1.90 1999/03/31 13:55:12 peter
  2102. * assembler inlining working for ag386bin
  2103. Revision 1.89 1999/03/26 00:05:36 peter
  2104. * released valintern
  2105. + deffile is now removed when compiling is finished
  2106. * ^( compiles now correct
  2107. + static directive
  2108. * shrd fixed
  2109. Revision 1.88 1999/03/24 23:17:15 peter
  2110. * fixed bugs 212,222,225,227,229,231,233
  2111. Revision 1.87 1999/03/16 17:52:52 jonas
  2112. * changes for internal Val code (do a "make cycle OPT=-dvalintern" to test)
  2113. * in cgi386inl: also range checking for subrange types (compile with "-dreadrangecheck")
  2114. * in cgai386: also small fixes to emitrangecheck
  2115. Revision 1.86 1999/03/04 13:55:44 pierre
  2116. * some m68k fixes (still not compilable !)
  2117. * new(tobj) does not give warning if tobj has no VMT !
  2118. Revision 1.85 1999/02/22 15:09:39 florian
  2119. * behaviaor of PROTECTED and PRIVATE fixed, works now like TP/Delphi
  2120. Revision 1.84 1999/02/22 02:15:26 peter
  2121. * updates for ag386bin
  2122. Revision 1.83 1999/02/11 09:46:25 pierre
  2123. * fix for normal method calls inside static methods :
  2124. WARNING there were both parser and codegen errors !!
  2125. added static_call boolean to calln tree
  2126. Revision 1.82 1999/01/28 14:06:47 florian
  2127. * small fix for method pointers
  2128. * found the annoying strpas bug, mainly nested call to type cast which
  2129. use ansistrings crash
  2130. Revision 1.81 1999/01/27 00:13:55 florian
  2131. * "procedure of object"-stuff fixed
  2132. Revision 1.80 1999/01/21 16:41:01 pierre
  2133. * fix for constructor inside with statements
  2134. Revision 1.79 1998/12/30 22:15:48 peter
  2135. + farpointer type
  2136. * absolutesym now also stores if its far
  2137. Revision 1.78 1998/12/11 00:03:32 peter
  2138. + globtype,tokens,version unit splitted from globals
  2139. Revision 1.77 1998/12/04 10:18:09 florian
  2140. * some stuff for procedures of object added
  2141. * bug with overridden virtual constructors fixed (reported by Italo Gomes)
  2142. Revision 1.76 1998/11/27 14:50:40 peter
  2143. + open strings, $P switch support
  2144. Revision 1.75 1998/11/25 19:12:51 pierre
  2145. * var:=new(pointer_type) support added
  2146. Revision 1.74 1998/11/13 10:18:11 peter
  2147. + nil constants
  2148. Revision 1.73 1998/11/05 12:02:52 peter
  2149. * released useansistring
  2150. * removed -Sv, its now available in fpc modes
  2151. Revision 1.72 1998/11/04 10:11:41 peter
  2152. * ansistring fixes
  2153. Revision 1.71 1998/10/22 23:57:29 peter
  2154. * fixed filedef for typenodetype
  2155. Revision 1.70 1998/10/21 15:12:54 pierre
  2156. * bug fix for IOCHECK inside a procedure with iocheck modifier
  2157. * removed the GPF for unexistant overloading
  2158. (firstcall was called with procedinition=nil !)
  2159. * changed typen to what Florian proposed
  2160. gentypenode(p : pdef) sets the typenodetype field
  2161. and resulttype is only set if inside bt_type block !
  2162. Revision 1.69 1998/10/20 15:10:19 pierre
  2163. * type ptree only allowed inside expression
  2164. if following sizeof typeof low high or as first arg of new !!
  2165. Revision 1.68 1998/10/20 11:15:44 pierre
  2166. * calling of private method allowed inside child object method
  2167. Revision 1.67 1998/10/19 08:54:57 pierre
  2168. * wrong stabs info corrected once again !!
  2169. + variable vmt offset with vmt field only if required
  2170. implemented now !!!
  2171. Revision 1.66 1998/10/15 15:13:28 pierre
  2172. + added oo_hasconstructor and oo_hasdestructor
  2173. for objects options
  2174. Revision 1.65 1998/10/13 13:10:24 peter
  2175. * new style for m68k/i386 infos and enums
  2176. Revision 1.64 1998/10/12 12:20:55 pierre
  2177. + added tai_const_symbol_offset
  2178. for r : pointer = @var.field;
  2179. * better message for different arg names on implementation
  2180. of function
  2181. Revision 1.63 1998/10/12 10:28:30 florian
  2182. + auto dereferencing of pointers to structured types in delphi mode
  2183. Revision 1.62 1998/10/12 10:05:41 peter
  2184. * fixed mem leak with arrayconstrutor
  2185. Revision 1.61 1998/10/05 13:57:15 peter
  2186. * crash preventions
  2187. Revision 1.60 1998/10/05 12:32:46 peter
  2188. + assert() support
  2189. Revision 1.59 1998/10/01 14:56:24 peter
  2190. * crash preventions
  2191. Revision 1.58 1998/09/30 07:40:35 florian
  2192. * better error recovering
  2193. Revision 1.57 1998/09/28 16:18:16 florian
  2194. * two fixes to get ansi strings work
  2195. Revision 1.56 1998/09/26 17:45:36 peter
  2196. + idtoken and only one token table
  2197. Revision 1.55 1998/09/24 23:49:10 peter
  2198. + aktmodeswitches
  2199. Revision 1.54 1998/09/23 15:46:39 florian
  2200. * problem with with and classes fixed
  2201. Revision 1.53 1998/09/23 09:58:54 peter
  2202. * first working array of const things
  2203. Revision 1.52 1998/09/20 09:38:45 florian
  2204. * hasharray for defs fixed
  2205. * ansistring code generation corrected (init/final, assignement)
  2206. Revision 1.51 1998/09/18 16:03:43 florian
  2207. * some changes to compile with Delphi
  2208. Revision 1.50 1998/09/17 13:41:18 pierre
  2209. sizeof(TPOINT) problem
  2210. Revision 1.49.2.1 1998/09/17 08:42:31 pierre
  2211. TPOINT sizeof fix
  2212. Revision 1.49 1998/09/09 11:50:53 pierre
  2213. * forward def are not put in record or objects
  2214. + added check for forwards also in record and objects
  2215. * dummy parasymtable for unit initialization removed from
  2216. symtable stack
  2217. Revision 1.48 1998/09/07 22:25:53 peter
  2218. * fixed str(boolean,string) which was allowed
  2219. * fixed write(' ':<int expression>) only constants where allowed :(
  2220. Revision 1.47 1998/09/07 18:46:10 peter
  2221. * update smartlinking, uses getdatalabel
  2222. * renamed ptree.value vars to value_str,value_real,value_set
  2223. Revision 1.46 1998/09/04 08:42:03 peter
  2224. * updated some error messages
  2225. Revision 1.45 1998/09/01 17:39:49 peter
  2226. + internal constant functions
  2227. Revision 1.44 1998/08/28 10:54:24 peter
  2228. * fixed smallset generation from elements, it has never worked before!
  2229. Revision 1.43 1998/08/23 16:07:24 florian
  2230. * internalerror with mod/div fixed
  2231. Revision 1.42 1998/08/21 14:08:50 pierre
  2232. + TEST_FUNCRET now default (old code removed)
  2233. works also for m68k (at least compiles)
  2234. Revision 1.41 1998/08/20 21:36:39 peter
  2235. * fixed 'with object do' bug
  2236. Revision 1.40 1998/08/20 09:26:41 pierre
  2237. + funcret setting in underproc testing
  2238. compile with _dTEST_FUNCRET
  2239. Revision 1.39 1998/08/18 16:48:48 pierre
  2240. * bug for -So proc assignment to p^rocvar fixed
  2241. Revision 1.38 1998/08/18 14:17:09 pierre
  2242. * bug about assigning the return value of a function to
  2243. a procvar fixed : warning
  2244. assigning a proc to a procvar need @ in FPC mode !!
  2245. * missing file/line info restored
  2246. Revision 1.37 1998/08/18 09:24:43 pierre
  2247. * small warning position bug fixed
  2248. * support_mmx switches splitting was missing
  2249. * rhide error and warning output corrected
  2250. Revision 1.36 1998/08/15 16:50:29 peter
  2251. * fixed proc()=expr which was not allowed anymore by my previous fix
  2252. Revision 1.35 1998/08/14 18:18:46 peter
  2253. + dynamic set contruction
  2254. * smallsets are now working (always longint size)
  2255. Revision 1.34 1998/08/13 11:00:12 peter
  2256. * fixed procedure<>procedure construct
  2257. Revision 1.33 1998/08/11 15:31:39 peter
  2258. * write extended to ppu file
  2259. * new version 0.99.7
  2260. Revision 1.32 1998/08/11 14:05:32 peter
  2261. * fixed sizeof(array of char)
  2262. Revision 1.31 1998/08/10 14:50:11 peter
  2263. + localswitches, moduleswitches, globalswitches splitting
  2264. Revision 1.30 1998/07/28 21:52:54 florian
  2265. + implementation of raise and try..finally
  2266. + some misc. exception stuff
  2267. Revision 1.29 1998/07/27 21:57:13 florian
  2268. * fix to allow tv like stream registration:
  2269. @tmenu.load doesn't work if load had parameters or if load was only
  2270. declared in an anchestor class of tmenu
  2271. Revision 1.28 1998/07/14 21:46:51 peter
  2272. * updated messages file
  2273. Revision 1.27 1998/06/25 14:04:23 peter
  2274. + internal inc/dec
  2275. Revision 1.26 1998/06/09 16:01:46 pierre
  2276. + added procedure directive parsing for procvars
  2277. (accepted are popstack cdecl and pascal)
  2278. + added C vars with the following syntax
  2279. var C calias 'true_c_name';(can be followed by external)
  2280. reason is that you must add the Cprefix
  2281. which is target dependent
  2282. Revision 1.25 1998/06/05 14:37:33 pierre
  2283. * fixes for inline for operators
  2284. * inline procedure more correctly restricted
  2285. Revision 1.24 1998/06/04 23:51:52 peter
  2286. * m68k compiles
  2287. + .def file creation moved to gendef.pas so it could also be used
  2288. for win32
  2289. Revision 1.23 1998/06/04 09:55:40 pierre
  2290. * demangled name of procsym reworked to become independant of the mangling scheme
  2291. Revision 1.22 1998/06/02 17:03:03 pierre
  2292. * with node corrected for objects
  2293. * small bugs for SUPPORT_MMX fixed
  2294. Revision 1.21 1998/05/27 19:45:05 peter
  2295. * symtable.pas splitted into includefiles
  2296. * symtable adapted for $ifdef NEWPPU
  2297. Revision 1.20 1998/05/26 07:53:59 pierre
  2298. * bug fix for empty sets (nil pd was dereferenced )
  2299. Revision 1.19 1998/05/25 17:11:43 pierre
  2300. * firstpasscount bug fixed
  2301. now all is already set correctly the first time
  2302. under EXTDEBUG try -gp to skip all other firstpasses
  2303. it works !!
  2304. * small bug fixes
  2305. - for smallsets with -dTESTSMALLSET
  2306. - some warnings removed (by correcting code !)
  2307. Revision 1.18 1998/05/23 01:21:20 peter
  2308. + aktasmmode, aktoptprocessor, aktoutputformat
  2309. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  2310. + $LIBNAME to set the library name where the unit will be put in
  2311. * splitted cgi386 a bit (codeseg to large for bp7)
  2312. * nasm, tasm works again. nasm moved to ag386nsm.pas
  2313. Revision 1.17 1998/05/22 12:37:03 carl
  2314. * crash bugfix (patched msanually to main branch)
  2315. Revision 1.16 1998/05/21 19:33:32 peter
  2316. + better procedure directive handling and only one table
  2317. Revision 1.15 1998/05/20 09:42:35 pierre
  2318. + UseTokenInfo now default
  2319. * unit in interface uses and implementation uses gives error now
  2320. * only one error for unknown symbol (uses lastsymknown boolean)
  2321. the problem came from the label code !
  2322. + first inlined procedures and function work
  2323. (warning there might be allowed cases were the result is still wrong !!)
  2324. * UseBrower updated gives a global list of all position of all used symbols
  2325. with switch -gb
  2326. Revision 1.14 1998/05/11 13:07:56 peter
  2327. + $ifdef NEWPPU for the new ppuformat
  2328. + $define GDB not longer required
  2329. * removed all warnings and stripped some log comments
  2330. * no findfirst/findnext anymore to remove smartlink *.o files
  2331. Revision 1.13 1998/05/06 08:38:45 pierre
  2332. * better position info with UseTokenInfo
  2333. UseTokenInfo greatly simplified
  2334. + added check for changed tree after first time firstpass
  2335. (if we could remove all the cases were it happen
  2336. we could skip all firstpass if firstpasscount > 1)
  2337. Only with ExtDebug
  2338. Revision 1.12 1998/05/05 12:05:42 florian
  2339. * problems with properties fixed
  2340. * crash fixed: i:=l when i and l are undefined, was a problem with
  2341. implementation of private/protected
  2342. Revision 1.11 1998/05/04 11:22:26 florian
  2343. * problem with DOM solved: it crashes when accessing a property in a method
  2344. Revision 1.10 1998/05/01 16:38:45 florian
  2345. * handling of private and protected fixed
  2346. + change_keywords_to_tp implemented to remove
  2347. keywords which aren't supported by tp
  2348. * break and continue are now symbols of the system unit
  2349. + widestring, longstring and ansistring type released
  2350. Revision 1.9 1998/04/29 10:33:58 pierre
  2351. + added some code for ansistring (not complete nor working yet)
  2352. * corrected operator overloading
  2353. * corrected nasm output
  2354. + started inline procedures
  2355. + added starstarn : use ** for exponentiation (^ gave problems)
  2356. + started UseTokenInfo cond to get accurate positions
  2357. Revision 1.8 1998/04/14 23:27:03 florian
  2358. + exclude/include with constant second parameter added
  2359. Revision 1.7 1998/04/09 23:02:15 florian
  2360. * small problems solved to get remake3 work
  2361. Revision 1.6 1998/04/09 22:16:35 florian
  2362. * problem with previous REGALLOC solved
  2363. * improved property support
  2364. Revision 1.5 1998/04/08 10:26:09 florian
  2365. * correct error handling of virtual constructors
  2366. * problem with new type declaration handling fixed
  2367. Revision 1.4 1998/04/07 22:45:05 florian
  2368. * bug0092, bug0115 and bug0121 fixed
  2369. + packed object/class/array
  2370. Revision 1.3 1998/04/07 13:19:46 pierre
  2371. * bugfixes for reset_gdb_info
  2372. in MEM parsing for go32v2
  2373. better external symbol creation
  2374. support for rhgdb.exe (lowercase file names)
  2375. }