pexpr.pas 77 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999
  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
  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 we read a type declaration }
  766. { we have to return the type and }
  767. { nothing else }
  768. if block_type=bt_type then
  769. begin
  770. p1:=genzeronode(typen);
  771. p1^.resulttype:=pd;
  772. pd:=voiddef;
  773. end
  774. else
  775. begin
  776. if token=LKLAMMER then
  777. begin
  778. consume(LKLAMMER);
  779. p1:=comp_expr(true);
  780. consume(RKLAMMER);
  781. p1:=gentypeconvnode(p1,pd);
  782. p1^.explizit:=true;
  783. end
  784. else
  785. if (token=POINT) and
  786. (pd^.deftype=objectdef) and
  787. ((pobjectdef(pd)^.options and oois_class)=0) then
  788. begin
  789. consume(POINT);
  790. if assigned(procinfo._class) then
  791. begin
  792. if procinfo._class^.isrelated(pobjectdef(pd)) then
  793. begin
  794. p1:=genzeronode(typen);
  795. p1^.resulttype:=pd;
  796. srsymtable:=pobjectdef(pd)^.publicsyms;
  797. sym:=pvarsym(srsymtable^.search(pattern));
  798. { search also in inherited methods }
  799. while sym=nil do
  800. begin
  801. pd:=pobjectdef(pd)^.childof;
  802. srsymtable:=pobjectdef(pd)^.publicsyms;
  803. sym:=pvarsym(srsymtable^.search(pattern));
  804. end;
  805. consume(ID);
  806. do_member_read(false,sym,p1,pd,again);
  807. end
  808. else
  809. begin
  810. Message(parser_e_no_super_class);
  811. pd:=generrordef;
  812. again:=false;
  813. end;
  814. end
  815. else
  816. begin
  817. { allows @TObject.Load }
  818. { also allows static methods and variables }
  819. p1:=genzeronode(typen);
  820. p1^.resulttype:=pd;
  821. { srsymtable:=pobjectdef(pd)^.publicsyms;
  822. sym:=pvarsym(srsymtable^.search(pattern)); }
  823. { TP allows also @TMenu.Load if Load is only }
  824. { defined in an anchestor class }
  825. sym:=pvarsym(search_class_member(pobjectdef(pd),pattern));
  826. if not(getaddr) and ((sym^.properties and sp_static)=0) then
  827. Message(sym_e_only_static_in_static)
  828. else
  829. begin
  830. consume(ID);
  831. do_member_read(getaddr,sym,p1,pd,again);
  832. end;
  833. end;
  834. end
  835. else
  836. begin
  837. { class reference ? }
  838. if (pd^.deftype=objectdef)
  839. and ((pobjectdef(pd)^.options and oois_class)<>0) then
  840. begin
  841. p1:=genzeronode(typen);
  842. p1^.resulttype:=pd;
  843. pd:=new(pclassrefdef,init(pd));
  844. p1:=gensinglenode(loadvmtn,p1);
  845. p1^.resulttype:=pd;
  846. end
  847. else
  848. begin
  849. { generate a type node }
  850. { (for typeof etc) }
  851. p1:=genzeronode(typen);
  852. p1^.resulttype:=pd;
  853. pd:=voiddef;
  854. end;
  855. end;
  856. end;
  857. end;
  858. enumsym : begin
  859. p1:=genenumnode(penumsym(srsym));
  860. pd:=p1^.resulttype;
  861. end;
  862. constsym : begin
  863. case pconstsym(srsym)^.consttype of
  864. constint : p1:=genordinalconstnode(pconstsym(srsym)^.value,s32bitdef);
  865. conststring : p1:=genstringconstnode(pstring(pconstsym(srsym)^.value)^);
  866. constchar : p1:=genordinalconstnode(pconstsym(srsym)^.value,cchardef);
  867. constreal : p1:=genrealconstnode(pbestreal(pconstsym(srsym)^.value)^);
  868. constbool : p1:=genordinalconstnode(pconstsym(srsym)^.value,booldef);
  869. constset : p1:=gensetconstnode(pconstset(pconstsym(srsym)^.value),
  870. psetdef(pconstsym(srsym)^.definition));
  871. constord : p1:=genordinalconstnode(pconstsym(srsym)^.value,
  872. pconstsym(srsym)^.definition);
  873. end;
  874. pd:=p1^.resulttype;
  875. end;
  876. procsym : begin
  877. { are we in a class method ? }
  878. possible_error:=(srsymtable^.symtabletype=objectsymtable) and
  879. assigned(aktprocsym) and
  880. ((aktprocsym^.definition^.options and poclassmethod)<>0);
  881. p1:=gencallnode(pprocsym(srsym),srsymtable);
  882. p1^.unit_specific:=unit_specific;
  883. do_proc_call(getaddr or
  884. (getprocvar and
  885. proc_to_procvar_equal(getprocvardef,pprocsym(srsym)^.definition)),
  886. again,p1,pd);
  887. if possible_error and
  888. ((p1^.procdefinition^.options and poclassmethod)=0) then
  889. Message(parser_e_only_class_methods);
  890. end;
  891. propertysym : begin
  892. { access to property in a method }
  893. { are we in a class method ? }
  894. if (srsymtable^.symtabletype=objectsymtable) and
  895. assigned(aktprocsym) and
  896. ((aktprocsym^.definition^.options and poclassmethod)<>0) then
  897. Message(parser_e_only_class_methods);
  898. { no method pointer }
  899. p1:=nil;
  900. handle_propertysym(srsym,srsymtable,p1,pd);
  901. end;
  902. errorsym : begin
  903. p1:=genzeronode(errorn);
  904. pd:=generrordef;
  905. if token=LKLAMMER then
  906. begin
  907. consume(LKLAMMER);
  908. parse_paras(false,false);
  909. consume(RKLAMMER);
  910. end;
  911. end;
  912. else
  913. begin
  914. p1:=genzeronode(errorn);
  915. pd:=generrordef;
  916. Message(cg_e_illegal_expression);
  917. end;
  918. end; { end case }
  919. end;
  920. end;
  921. end;
  922. end;
  923. {---------------------------------------------
  924. Factor_Read_Set
  925. ---------------------------------------------}
  926. { Read a set between [] }
  927. function factor_read_set:ptree;
  928. var
  929. p1,
  930. lastp,
  931. buildp : ptree;
  932. begin
  933. buildp:=nil;
  934. { be sure that a least one arrayconstructn is used, also for an
  935. empty [] }
  936. if token=RECKKLAMMER then
  937. buildp:=gennode(arrayconstructn,nil,buildp)
  938. else
  939. begin
  940. while true do
  941. begin
  942. p1:=comp_expr(true);
  943. do_firstpass(p1);
  944. if codegenerror then
  945. break;
  946. if token=POINTPOINT then
  947. begin
  948. consume(POINTPOINT);
  949. p2:=comp_expr(true);
  950. do_firstpass(p2);
  951. if codegenerror then
  952. break;
  953. p1:=gennode(arrayconstructrangen,p1,p2);
  954. end;
  955. { insert at the end of the tree, to get the correct order }
  956. if not assigned(buildp) then
  957. begin
  958. buildp:=gensinglenode(arrayconstructn,p1);
  959. lastp:=buildp;
  960. end
  961. else
  962. begin
  963. lastp^.right:=gensinglenode(arrayconstructn,p1);
  964. lastp:=lastp^.right;
  965. end;
  966. { there could be more elements }
  967. if token=COMMA then
  968. consume(COMMA)
  969. else
  970. break;
  971. end;
  972. end;
  973. factor_read_set:=buildp;
  974. end;
  975. {---------------------------------------------
  976. Helpers
  977. ---------------------------------------------}
  978. procedure check_tokenpos;
  979. begin
  980. if (p1<>oldp1) then
  981. begin
  982. if assigned(p1) then
  983. set_tree_filepos(p1,filepos);
  984. oldp1:=p1;
  985. filepos:=tokenpos;
  986. end;
  987. end;
  988. {---------------------------------------------
  989. PostFixOperators
  990. ---------------------------------------------}
  991. procedure postfixoperators;
  992. { p1 and p2 must contain valid value_str }
  993. begin
  994. check_tokenpos;
  995. while again do
  996. begin
  997. case token of
  998. CARET : begin
  999. consume(CARET);
  1000. if pd^.deftype<>pointerdef then
  1001. begin
  1002. { ^ as binary operator is a problem!!!! (FK) }
  1003. again:=false;
  1004. Message(cg_e_invalid_qualifier);
  1005. disposetree(p1);
  1006. p1:=genzeronode(errorn);
  1007. end
  1008. else
  1009. begin
  1010. p1:=gensinglenode(derefn,p1);
  1011. pd:=ppointerdef(pd)^.definition;
  1012. end;
  1013. end;
  1014. LECKKLAMMER : begin
  1015. if (pd^.deftype=objectdef) and pobjectdef(pd)^.isclass then
  1016. begin
  1017. { default property }
  1018. propsym:=search_default_property(pobjectdef(pd));
  1019. if not(assigned(propsym)) then
  1020. begin
  1021. disposetree(p1);
  1022. p1:=genzeronode(errorn);
  1023. again:=false;
  1024. message(parser_e_no_default_property_available);
  1025. end
  1026. else
  1027. begin
  1028. p1:=nil;
  1029. handle_propertysym(propsym,propsym^.owner,p1,pd);
  1030. end;
  1031. end
  1032. else
  1033. begin
  1034. consume(LECKKLAMMER);
  1035. repeat
  1036. case pd^.deftype of
  1037. pointerdef : begin
  1038. p2:=comp_expr(true);
  1039. p1:=gennode(vecn,p1,p2);
  1040. pd:=ppointerdef(pd)^.definition;
  1041. end;
  1042. stringdef : begin
  1043. p2:=comp_expr(true);
  1044. p1:=gennode(vecn,p1,p2);
  1045. pd:=cchardef
  1046. end;
  1047. arraydef : begin
  1048. p2:=comp_expr(true);
  1049. {$ifdef i386}
  1050. { support SEG:OFS for go32v2 Mem[] }
  1051. if (target_info.target=target_GO32V2) and
  1052. (p1^.treetype=loadn) and
  1053. assigned(p1^.symtableentry) and
  1054. assigned(p1^.symtableentry^.owner^.name) and
  1055. (p1^.symtableentry^.owner^.name^='SYSTEM') and
  1056. ((p1^.symtableentry^.name='MEM') or
  1057. (p1^.symtableentry^.name='MEMW') or
  1058. (p1^.symtableentry^.name='MEML')) then
  1059. begin
  1060. if (token=COLON) then
  1061. begin
  1062. consume(COLON);
  1063. p3:=gennode(muln,genordinalconstnode($10,s32bitdef),p2);
  1064. p2:=comp_expr(true);
  1065. p2:=gennode(addn,p2,p3);
  1066. p1:=gennode(vecn,p1,p2);
  1067. p1^.memseg:=true;
  1068. p1^.memindex:=true;
  1069. end
  1070. else
  1071. begin
  1072. p1:=gennode(vecn,p1,p2);
  1073. p1^.memindex:=true;
  1074. end;
  1075. end
  1076. else
  1077. {$endif}
  1078. p1:=gennode(vecn,p1,p2);
  1079. pd:=parraydef(pd)^.definition;
  1080. end;
  1081. else
  1082. begin
  1083. Message(cg_e_invalid_qualifier);
  1084. disposetree(p1);
  1085. p1:=genzeronode(errorn);
  1086. again:=false;
  1087. end;
  1088. end;
  1089. if token=COMMA then
  1090. consume(COMMA)
  1091. else
  1092. break;
  1093. until false;
  1094. consume(RECKKLAMMER);
  1095. end;
  1096. end;
  1097. POINT : begin
  1098. consume(POINT);
  1099. case pd^.deftype of
  1100. recorddef : begin
  1101. sym:=pvarsym(precdef(pd)^.symtable^.search(pattern));
  1102. consume(ID);
  1103. if sym=nil then
  1104. begin
  1105. Message(sym_e_illegal_field);
  1106. disposetree(p1);
  1107. p1:=genzeronode(errorn);
  1108. end
  1109. else
  1110. begin
  1111. p1:=gensubscriptnode(sym,p1);
  1112. pd:=sym^.definition;
  1113. end;
  1114. end;
  1115. classrefdef : begin
  1116. classh:=pobjectdef(pclassrefdef(pd)^.definition);
  1117. sym:=nil;
  1118. while assigned(classh) do
  1119. begin
  1120. sym:=pvarsym(classh^.publicsyms^.search(pattern));
  1121. srsymtable:=classh^.publicsyms;
  1122. if assigned(sym) then
  1123. break;
  1124. classh:=classh^.childof;
  1125. end;
  1126. consume(ID);
  1127. do_member_read(false,sym,p1,pd,again);
  1128. end;
  1129. objectdef : begin
  1130. classh:=pobjectdef(pd);
  1131. sym:=nil;
  1132. while assigned(classh) do
  1133. begin
  1134. sym:=pvarsym(classh^.publicsyms^.search(pattern));
  1135. srsymtable:=classh^.publicsyms;
  1136. if assigned(sym) then
  1137. break;
  1138. classh:=classh^.childof;
  1139. end;
  1140. consume(ID);
  1141. do_member_read(false,sym,p1,pd,again);
  1142. end;
  1143. pointerdef : begin
  1144. Message(cg_e_invalid_qualifier);
  1145. if ppointerdef(pd)^.definition^.deftype in [recorddef,objectdef,classrefdef] then
  1146. Message(parser_h_maybe_deref_caret_missing);
  1147. end;
  1148. else
  1149. begin
  1150. Message(cg_e_invalid_qualifier);
  1151. disposetree(p1);
  1152. p1:=genzeronode(errorn);
  1153. end;
  1154. end;
  1155. end;
  1156. else
  1157. begin
  1158. { is this a procedure variable ? }
  1159. if assigned(pd) then
  1160. begin
  1161. if (pd^.deftype=procvardef) then
  1162. begin
  1163. if getprocvar and proc_to_procvar_equal(pprocvardef(pd),getprocvardef) then
  1164. again:=false
  1165. else
  1166. if (token=LKLAMMER) or
  1167. ((pprocvardef(pd)^.para1=nil) and
  1168. (not((token in [ASSIGNMENT,UNEQUAL,EQUAL]))) and
  1169. (not afterassignment) and
  1170. (not in_args)) then
  1171. begin
  1172. { do this in a strange way }
  1173. { it's not a clean solution }
  1174. p2:=p1;
  1175. p1:=gencallnode(nil,nil);
  1176. p1^.right:=p2;
  1177. p1^.unit_specific:=unit_specific;
  1178. p1^.symtableprocentry:=sym;
  1179. if token=LKLAMMER then
  1180. begin
  1181. consume(LKLAMMER);
  1182. p1^.left:=parse_paras(false,false);
  1183. consume(RKLAMMER);
  1184. end;
  1185. pd:=pprocvardef(pd)^.retdef;
  1186. { proc():= is never possible }
  1187. if token=ASSIGNMENT then
  1188. begin
  1189. Message(cg_e_illegal_expression);
  1190. p1:=genzeronode(errorn);
  1191. again:=false;
  1192. end;
  1193. p1^.resulttype:=pd;
  1194. end
  1195. else
  1196. again:=false;
  1197. p1^.resulttype:=pd;
  1198. end
  1199. else
  1200. again:=false;
  1201. end
  1202. else
  1203. again:=false;
  1204. end;
  1205. end;
  1206. check_tokenpos;
  1207. end; { while again }
  1208. end;
  1209. {---------------------------------------------
  1210. Factor (Main)
  1211. ---------------------------------------------}
  1212. begin
  1213. oldp1:=nil;
  1214. filepos:=tokenpos;
  1215. if token=ID then
  1216. begin
  1217. factor_read_id;
  1218. { handle post fix operators }
  1219. postfixoperators;
  1220. end
  1221. else
  1222. case token of
  1223. _NEW : begin
  1224. consume(_NEW);
  1225. consume(LKLAMMER);
  1226. p1:=factor(false);
  1227. if p1^.treetype<>typen then
  1228. Message(type_e_type_id_expected);
  1229. pd:=p1^.resulttype;
  1230. pd2:=pd;
  1231. if (pd^.deftype<>pointerdef) or
  1232. (ppointerdef(pd)^.definition^.deftype<>objectdef) then
  1233. begin
  1234. Message(parser_e_pointer_to_class_expected);
  1235. { if an error occurs, read til the end of
  1236. the new statement }
  1237. p1:=genzeronode(errorn);
  1238. l:=1;
  1239. while true do
  1240. begin
  1241. case token of
  1242. LKLAMMER : inc(l);
  1243. RKLAMMER : dec(l);
  1244. end;
  1245. consume(token);
  1246. if l=0 then
  1247. break;
  1248. end;
  1249. end
  1250. else
  1251. begin
  1252. disposetree(p1);
  1253. p1:=genzeronode(hnewn);
  1254. p1^.resulttype:=ppointerdef(pd)^.definition;
  1255. consume(COMMA);
  1256. afterassignment:=false;
  1257. { determines the current object defintion }
  1258. classh:=pobjectdef(ppointerdef(pd)^.definition);
  1259. { check for an abstract class }
  1260. if (classh^.options and oois_abstract)<>0 then
  1261. Message(sym_e_no_instance_of_abstract_object);
  1262. { search the constructor also in the symbol tables of
  1263. the parents }
  1264. { no constructor found }
  1265. sym:=nil;
  1266. while assigned(classh) do
  1267. begin
  1268. sym:=pvarsym(classh^.publicsyms^.search(pattern));
  1269. srsymtable:=classh^.publicsyms;
  1270. if assigned(sym) then
  1271. break;
  1272. classh:=classh^.childof;
  1273. end;
  1274. consume(ID);
  1275. do_member_read(false,sym,p1,pd,again);
  1276. if (p1^.treetype<>calln) or
  1277. (assigned(p1^.procdefinition) and
  1278. ((p1^.procdefinition^.options and poconstructor)=0)) then
  1279. Message(parser_e_expr_have_to_be_constructor_call);
  1280. p1:=gensinglenode(newn,p1);
  1281. { set the resulttype }
  1282. p1^.resulttype:=pd2;
  1283. consume(RKLAMMER);
  1284. end;
  1285. end;
  1286. _SELF : begin
  1287. again:=true;
  1288. consume(_SELF);
  1289. if not assigned(procinfo._class) then
  1290. begin
  1291. p1:=genzeronode(errorn);
  1292. pd:=generrordef;
  1293. again:=false;
  1294. Message(parser_e_self_not_in_method);
  1295. end
  1296. else
  1297. begin
  1298. if (aktprocsym^.definition^.options and poclassmethod)<>0 then
  1299. begin
  1300. { self in class methods is a class reference type }
  1301. pd:=new(pclassrefdef,init(procinfo._class));
  1302. p1:=genselfnode(pd);
  1303. p1^.resulttype:=pd;
  1304. end
  1305. else
  1306. begin
  1307. p1:=genselfnode(procinfo._class);
  1308. p1^.resulttype:=procinfo._class;
  1309. end;
  1310. pd:=p1^.resulttype;
  1311. postfixoperators;
  1312. end;
  1313. end;
  1314. _INHERITED : begin
  1315. again:=true;
  1316. consume(_INHERITED);
  1317. if assigned(procinfo._class) then
  1318. begin
  1319. classh:=procinfo._class^.childof;
  1320. while assigned(classh) do
  1321. begin
  1322. srsymtable:=pobjectdef(classh)^.publicsyms;
  1323. sym:=pvarsym(srsymtable^.search(pattern));
  1324. if assigned(sym) then
  1325. begin
  1326. p1:=genzeronode(typen);
  1327. p1^.resulttype:=classh;
  1328. pd:=p1^.resulttype;
  1329. consume(ID);
  1330. do_member_read(false,sym,p1,pd,again);
  1331. break;
  1332. end;
  1333. classh:=classh^.childof;
  1334. end;
  1335. if classh=nil then
  1336. begin
  1337. Message1(sym_e_id_no_member,pattern);
  1338. again:=false;
  1339. pd:=generrordef;
  1340. p1:=genzeronode(errorn);
  1341. end;
  1342. end
  1343. else
  1344. Message(parser_e_generic_methods_only_in_methods);
  1345. postfixoperators;
  1346. end;
  1347. INTCONST : begin
  1348. valint(pattern,l,code);
  1349. if code<>0 then
  1350. begin
  1351. val(pattern,d,code);
  1352. if code<>0 then
  1353. begin
  1354. Message(cg_e_invalid_integer);
  1355. consume(INTCONST);
  1356. l:=1;
  1357. p1:=genordinalconstnode(l,s32bitdef);
  1358. end
  1359. else
  1360. begin
  1361. consume(INTCONST);
  1362. p1:=genrealconstnode(d);
  1363. end;
  1364. end
  1365. else
  1366. begin
  1367. consume(INTCONST);
  1368. p1:=genordinalconstnode(l,s32bitdef);
  1369. end;
  1370. end;
  1371. REALNUMBER : begin
  1372. val(pattern,d,code);
  1373. if code<>0 then
  1374. begin
  1375. Message(parser_e_error_in_real);
  1376. d:=1.0;
  1377. end;
  1378. consume(REALNUMBER);
  1379. p1:=genrealconstnode(d);
  1380. end;
  1381. _STRING : begin
  1382. { STRING can be also a type cast }
  1383. pd:=stringtype;
  1384. consume(LKLAMMER);
  1385. p1:=comp_expr(true);
  1386. consume(RKLAMMER);
  1387. p1:=gentypeconvnode(p1,pd);
  1388. p1^.explizit:=true;
  1389. { handle postfix operators here e.g. string(a)[10] }
  1390. again:=true;
  1391. postfixoperators;
  1392. end;
  1393. _FILE : begin
  1394. { FILE can be also a type cast }
  1395. pd:=cfiledef;
  1396. consume(_FILE);
  1397. if token=LKLAMMER then
  1398. begin
  1399. consume(LKLAMMER);
  1400. p1:=comp_expr(true);
  1401. consume(RKLAMMER);
  1402. p1:=gentypeconvnode(p1,pd);
  1403. end
  1404. else
  1405. begin
  1406. p1:=genzeronode(typen);
  1407. p1^.resulttype:=pd;
  1408. end;
  1409. p1^.explizit:=true;
  1410. { handle postfix operators here e.g. string(a)[10] }
  1411. again:=true;
  1412. postfixoperators;
  1413. end;
  1414. CSTRING : begin
  1415. p1:=genstringconstnode(pattern);
  1416. consume(CSTRING);
  1417. end;
  1418. CCHAR : begin
  1419. p1:=genordinalconstnode(ord(pattern[1]),cchardef);
  1420. consume(CCHAR);
  1421. end;
  1422. KLAMMERAFFE : begin
  1423. consume(KLAMMERAFFE);
  1424. p1:=factor(true);
  1425. p1:=gensinglenode(addrn,p1);
  1426. end;
  1427. LKLAMMER : begin
  1428. consume(LKLAMMER);
  1429. p1:=comp_expr(true);
  1430. consume(RKLAMMER);
  1431. { it's not a good solution }
  1432. { but (a+b)^ makes some problems }
  1433. if token in [CARET,POINT,LECKKLAMMER] then
  1434. begin
  1435. { we need the resulttype }
  1436. { of the expression in pd }
  1437. do_firstpass(p1);
  1438. pd:=p1^.resulttype;
  1439. again:=true;
  1440. postfixoperators;
  1441. end;
  1442. end;
  1443. LECKKLAMMER : begin
  1444. consume(LECKKLAMMER);
  1445. p1:=factor_read_set;
  1446. consume(RECKKLAMMER);
  1447. end;
  1448. PLUS : begin
  1449. consume(PLUS);
  1450. p1:=factor(false);
  1451. end;
  1452. MINUS : begin
  1453. consume(MINUS);
  1454. p1:=factor(false);
  1455. p1:=gensinglenode(umminusn,p1);
  1456. end;
  1457. _NOT : begin
  1458. consume(_NOT);
  1459. p1:=factor(false);
  1460. p1:=gensinglenode(notn,p1);
  1461. end;
  1462. _TRUE : begin
  1463. consume(_TRUE);
  1464. p1:=genordinalconstnode(1,booldef);
  1465. end;
  1466. _FALSE : begin
  1467. consume(_FALSE);
  1468. p1:=genordinalconstnode(0,booldef);
  1469. end;
  1470. _NIL : begin
  1471. consume(_NIL);
  1472. p1:=genzeronode(niln);
  1473. end;
  1474. else
  1475. begin
  1476. p1:=genzeronode(errorn);
  1477. consume(token);
  1478. Message(cg_e_illegal_expression);
  1479. end;
  1480. end;
  1481. factor:=p1;
  1482. check_tokenpos;
  1483. end;
  1484. {****************************************************************************
  1485. Sub_Expr
  1486. ****************************************************************************}
  1487. type
  1488. Toperator_precedence=(opcompare,opaddition,opmultiply);
  1489. Ttok2nodeRec=record
  1490. tok : ttoken;
  1491. nod : ttreetyp;
  1492. end;
  1493. const
  1494. tok2nodes=23;
  1495. tok2node:array[1..tok2nodes] of ttok2noderec=(
  1496. (tok:PLUS ;nod:addn),
  1497. (tok:MINUS ;nod:subn),
  1498. (tok:STAR ;nod:muln),
  1499. (tok:SLASH ;nod:slashn),
  1500. (tok:EQUAL ;nod:equaln),
  1501. (tok:GT ;nod:gtn),
  1502. (tok:LT ;nod:ltn),
  1503. (tok:GTE ;nod:gten),
  1504. (tok:LTE ;nod:lten),
  1505. (tok:SYMDIF ;nod:symdifn),
  1506. (tok:STARSTAR;nod:starstarn),
  1507. (tok:CARET ;nod:caretn),
  1508. (tok:UNEQUAL ;nod:unequaln),
  1509. (tok:_AS ;nod:asn),
  1510. (tok:_IN ;nod:inn),
  1511. (tok:_IS ;nod:isn),
  1512. (tok:_OR ;nod:orn),
  1513. (tok:_AND ;nod:andn),
  1514. (tok:_DIV ;nod:divn),
  1515. (tok:_MOD ;nod:modn),
  1516. (tok:_SHL ;nod:shln),
  1517. (tok:_SHR ;nod:shrn),
  1518. (tok:_XOR ;nod:xorn)
  1519. );
  1520. operator_levels:array[Toperator_precedence] of set of Ttoken=
  1521. ([LT,LTE,GT,GTE,EQUAL,UNEQUAL,_IN,_IS],
  1522. [PLUS,MINUS,_OR,_XOR],
  1523. [CARET,SYMDIF,STARSTAR,STAR,SLASH,_DIV,_MOD,_AND,_SHL,_SHR,_AS]);
  1524. function sub_expr(pred_level:Toperator_precedence;accept_equal : boolean):Ptree;
  1525. {Reads a subexpression while the operators are of the current precedence
  1526. level, or any higher level. Replaces the old term, simpl_expr and
  1527. simpl2_expr.}
  1528. var
  1529. low,high,mid : longint;
  1530. p1,p2 : Ptree;
  1531. oldt : Ttoken;
  1532. filepos : tfileposinfo;
  1533. begin
  1534. if pred_level=opmultiply then
  1535. p1:=factor(false)
  1536. else
  1537. p1:=sub_expr(succ(pred_level),true);
  1538. repeat
  1539. if (token in operator_levels[pred_level]) and
  1540. ((token<>EQUAL) or accept_equal) then
  1541. begin
  1542. oldt:=token;
  1543. filepos:=tokenpos;
  1544. consume(token);
  1545. if pred_level=opmultiply then
  1546. p2:=factor(false)
  1547. else
  1548. p2:=sub_expr(succ(pred_level),true);
  1549. low:=1;
  1550. high:=tok2nodes;
  1551. while (low<high) do
  1552. begin
  1553. mid:=(low+high+1) shr 1;
  1554. if oldt<tok2node[mid].tok then
  1555. high:=mid-1
  1556. else
  1557. low:=mid;
  1558. end;
  1559. if tok2node[high].tok=oldt then
  1560. p1:=gennode(tok2node[high].nod,p1,p2)
  1561. else
  1562. p1:=gennode(nothingn,p1,p2);
  1563. set_tree_filepos(p1,filepos);
  1564. end
  1565. else
  1566. break;
  1567. until false;
  1568. sub_expr:=p1;
  1569. end;
  1570. function comp_expr(accept_equal : boolean):Ptree;
  1571. var
  1572. oldafterassignment : boolean;
  1573. begin
  1574. oldafterassignment:=afterassignment;
  1575. afterassignment:=true;
  1576. comp_expr:=sub_expr(opcompare,accept_equal);
  1577. afterassignment:=oldafterassignment;
  1578. end;
  1579. function expr : ptree;
  1580. var
  1581. p1,p2 : ptree;
  1582. oldafterassignment : boolean;
  1583. oldp1 : ptree;
  1584. filepos : tfileposinfo;
  1585. begin
  1586. oldafterassignment:=afterassignment;
  1587. p1:=sub_expr(opcompare,true);
  1588. if token in [ASSIGNMENT,_PLUSASN,_MINUSASN,_STARASN,_SLASHASN] then
  1589. afterassignment:=true;
  1590. filepos:=tokenpos;
  1591. oldp1:=p1;
  1592. case token of
  1593. POINTPOINT : begin
  1594. consume(POINTPOINT);
  1595. p2:=sub_expr(opcompare,true);
  1596. p1:=gennode(rangen,p1,p2);
  1597. end;
  1598. ASSIGNMENT : begin
  1599. consume(ASSIGNMENT);
  1600. { avoid a firstpass of a procedure if
  1601. it must be assigned to a procvar }
  1602. { should be recursive for a:=b:=c !!! }
  1603. if (p1^.resulttype<>nil) and (p1^.resulttype^.deftype=procvardef) then
  1604. begin
  1605. getprocvar:=true;
  1606. getprocvardef:=pprocvardef(p1^.resulttype);
  1607. end;
  1608. p2:=sub_expr(opcompare,true);
  1609. if getprocvar and (p2^.treetype=calln) and
  1610. (proc_to_procvar_equal(getprocvardef,pprocsym(p2^.symtableentry)^.definition)) then
  1611. begin
  1612. p2^.treetype:=loadn;
  1613. p2^.resulttype:=pprocsym(p2^.symtableprocentry)^.definition;
  1614. p2^.symtableentry:=p2^.symtableprocentry;
  1615. end;
  1616. getprocvar:=false;
  1617. p1:=gennode(assignn,p1,p2);
  1618. end;
  1619. { this is the code for C like assignements }
  1620. { from an improvement of Peter Schaefer }
  1621. _PLUSASN : begin
  1622. consume(_PLUSASN );
  1623. p2:=sub_expr(opcompare,true);
  1624. p1:=gennode(assignn,p1,gennode(addn,getcopy(p1),p2));
  1625. { was first
  1626. p1:=gennode(assignn,p1,gennode(addn,p1,p2));
  1627. but disposetree assumes that we have a real
  1628. *** tree *** }
  1629. end;
  1630. _MINUSASN : begin
  1631. consume(_MINUSASN );
  1632. p2:=sub_expr(opcompare,true);
  1633. p1:=gennode(assignn,p1,gennode(subn,getcopy(p1),p2));
  1634. end;
  1635. _STARASN : begin
  1636. consume(_STARASN );
  1637. p2:=sub_expr(opcompare,true);
  1638. p1:=gennode(assignn,p1,gennode(muln,getcopy(p1),p2));
  1639. end;
  1640. _SLASHASN : begin
  1641. consume(_SLASHASN );
  1642. p2:=sub_expr(opcompare,true);
  1643. p1:=gennode(assignn,p1,gennode(slashn,getcopy(p1),p2));
  1644. end;
  1645. end;
  1646. afterassignment:=oldafterassignment;
  1647. if p1<>oldp1 then
  1648. set_tree_filepos(p1,filepos);
  1649. expr:=p1;
  1650. end;
  1651. function get_intconst:longint;
  1652. {Reads an expression, tries to evalute it and check if it is an integer
  1653. constant. Then the constant is returned.}
  1654. var
  1655. p:Ptree;
  1656. begin
  1657. p:=comp_expr(true);
  1658. do_firstpass(p);
  1659. if (p^.treetype<>ordconstn) and
  1660. (p^.resulttype^.deftype=orddef) and
  1661. not(Porddef(p^.resulttype)^.typ in [uvoid,uchar,bool8bit,bool16bit,bool32bit]) then
  1662. Message(cg_e_illegal_expression)
  1663. else
  1664. get_intconst:=p^.value;
  1665. disposetree(p);
  1666. end;
  1667. function get_stringconst:string;
  1668. {Reads an expression, tries to evaluate it and checks if it is a string
  1669. constant. Then the constant is returned.}
  1670. var
  1671. p:Ptree;
  1672. begin
  1673. get_stringconst:='';
  1674. p:=comp_expr(true);
  1675. do_firstpass(p);
  1676. if p^.treetype<>stringconstn then
  1677. begin
  1678. if (p^.treetype=ordconstn) and
  1679. (p^.resulttype^.deftype=orddef) and
  1680. (Porddef(p^.resulttype)^.typ=uchar) then
  1681. get_stringconst:=char(p^.value)
  1682. else
  1683. Message(cg_e_illegal_expression);
  1684. end
  1685. else
  1686. get_stringconst:=p^.value_str^;
  1687. disposetree(p);
  1688. end;
  1689. end.
  1690. {
  1691. $Log$
  1692. Revision 1.56 1998-09-26 17:45:36 peter
  1693. + idtoken and only one token table
  1694. Revision 1.55 1998/09/24 23:49:10 peter
  1695. + aktmodeswitches
  1696. Revision 1.54 1998/09/23 15:46:39 florian
  1697. * problem with with and classes fixed
  1698. Revision 1.53 1998/09/23 09:58:54 peter
  1699. * first working array of const things
  1700. Revision 1.52 1998/09/20 09:38:45 florian
  1701. * hasharray for defs fixed
  1702. * ansistring code generation corrected (init/final, assignement)
  1703. Revision 1.51 1998/09/18 16:03:43 florian
  1704. * some changes to compile with Delphi
  1705. Revision 1.50 1998/09/17 13:41:18 pierre
  1706. sizeof(TPOINT) problem
  1707. Revision 1.49.2.1 1998/09/17 08:42:31 pierre
  1708. TPOINT sizeof fix
  1709. Revision 1.49 1998/09/09 11:50:53 pierre
  1710. * forward def are not put in record or objects
  1711. + added check for forwards also in record and objects
  1712. * dummy parasymtable for unit initialization removed from
  1713. symtable stack
  1714. Revision 1.48 1998/09/07 22:25:53 peter
  1715. * fixed str(boolean,string) which was allowed
  1716. * fixed write(' ':<int expression>) only constants where allowed :(
  1717. Revision 1.47 1998/09/07 18:46:10 peter
  1718. * update smartlinking, uses getdatalabel
  1719. * renamed ptree.value vars to value_str,value_real,value_set
  1720. Revision 1.46 1998/09/04 08:42:03 peter
  1721. * updated some error messages
  1722. Revision 1.45 1998/09/01 17:39:49 peter
  1723. + internal constant functions
  1724. Revision 1.44 1998/08/28 10:54:24 peter
  1725. * fixed smallset generation from elements, it has never worked before!
  1726. Revision 1.43 1998/08/23 16:07:24 florian
  1727. * internalerror with mod/div fixed
  1728. Revision 1.42 1998/08/21 14:08:50 pierre
  1729. + TEST_FUNCRET now default (old code removed)
  1730. works also for m68k (at least compiles)
  1731. Revision 1.41 1998/08/20 21:36:39 peter
  1732. * fixed 'with object do' bug
  1733. Revision 1.40 1998/08/20 09:26:41 pierre
  1734. + funcret setting in underproc testing
  1735. compile with _dTEST_FUNCRET
  1736. Revision 1.39 1998/08/18 16:48:48 pierre
  1737. * bug for -So proc assignment to p^rocvar fixed
  1738. Revision 1.38 1998/08/18 14:17:09 pierre
  1739. * bug about assigning the return value of a function to
  1740. a procvar fixed : warning
  1741. assigning a proc to a procvar need @ in FPC mode !!
  1742. * missing file/line info restored
  1743. Revision 1.37 1998/08/18 09:24:43 pierre
  1744. * small warning position bug fixed
  1745. * support_mmx switches splitting was missing
  1746. * rhide error and warning output corrected
  1747. Revision 1.36 1998/08/15 16:50:29 peter
  1748. * fixed proc()=expr which was not allowed anymore by my previous fix
  1749. Revision 1.35 1998/08/14 18:18:46 peter
  1750. + dynamic set contruction
  1751. * smallsets are now working (always longint size)
  1752. Revision 1.34 1998/08/13 11:00:12 peter
  1753. * fixed procedure<>procedure construct
  1754. Revision 1.33 1998/08/11 15:31:39 peter
  1755. * write extended to ppu file
  1756. * new version 0.99.7
  1757. Revision 1.32 1998/08/11 14:05:32 peter
  1758. * fixed sizeof(array of char)
  1759. Revision 1.31 1998/08/10 14:50:11 peter
  1760. + localswitches, moduleswitches, globalswitches splitting
  1761. Revision 1.30 1998/07/28 21:52:54 florian
  1762. + implementation of raise and try..finally
  1763. + some misc. exception stuff
  1764. Revision 1.29 1998/07/27 21:57:13 florian
  1765. * fix to allow tv like stream registration:
  1766. @tmenu.load doesn't work if load had parameters or if load was only
  1767. declared in an anchestor class of tmenu
  1768. Revision 1.28 1998/07/14 21:46:51 peter
  1769. * updated messages file
  1770. Revision 1.27 1998/06/25 14:04:23 peter
  1771. + internal inc/dec
  1772. Revision 1.26 1998/06/09 16:01:46 pierre
  1773. + added procedure directive parsing for procvars
  1774. (accepted are popstack cdecl and pascal)
  1775. + added C vars with the following syntax
  1776. var C calias 'true_c_name';(can be followed by external)
  1777. reason is that you must add the Cprefix
  1778. which is target dependent
  1779. Revision 1.25 1998/06/05 14:37:33 pierre
  1780. * fixes for inline for operators
  1781. * inline procedure more correctly restricted
  1782. Revision 1.24 1998/06/04 23:51:52 peter
  1783. * m68k compiles
  1784. + .def file creation moved to gendef.pas so it could also be used
  1785. for win32
  1786. Revision 1.23 1998/06/04 09:55:40 pierre
  1787. * demangled name of procsym reworked to become independant of the mangling scheme
  1788. Revision 1.22 1998/06/02 17:03:03 pierre
  1789. * with node corrected for objects
  1790. * small bugs for SUPPORT_MMX fixed
  1791. Revision 1.21 1998/05/27 19:45:05 peter
  1792. * symtable.pas splitted into includefiles
  1793. * symtable adapted for $ifdef NEWPPU
  1794. Revision 1.20 1998/05/26 07:53:59 pierre
  1795. * bug fix for empty sets (nil pd was dereferenced )
  1796. Revision 1.19 1998/05/25 17:11:43 pierre
  1797. * firstpasscount bug fixed
  1798. now all is already set correctly the first time
  1799. under EXTDEBUG try -gp to skip all other firstpasses
  1800. it works !!
  1801. * small bug fixes
  1802. - for smallsets with -dTESTSMALLSET
  1803. - some warnings removed (by correcting code !)
  1804. Revision 1.18 1998/05/23 01:21:20 peter
  1805. + aktasmmode, aktoptprocessor, aktoutputformat
  1806. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  1807. + $LIBNAME to set the library name where the unit will be put in
  1808. * splitted cgi386 a bit (codeseg to large for bp7)
  1809. * nasm, tasm works again. nasm moved to ag386nsm.pas
  1810. Revision 1.17 1998/05/22 12:37:03 carl
  1811. * crash bugfix (patched msanually to main branch)
  1812. Revision 1.16 1998/05/21 19:33:32 peter
  1813. + better procedure directive handling and only one table
  1814. Revision 1.15 1998/05/20 09:42:35 pierre
  1815. + UseTokenInfo now default
  1816. * unit in interface uses and implementation uses gives error now
  1817. * only one error for unknown symbol (uses lastsymknown boolean)
  1818. the problem came from the label code !
  1819. + first inlined procedures and function work
  1820. (warning there might be allowed cases were the result is still wrong !!)
  1821. * UseBrower updated gives a global list of all position of all used symbols
  1822. with switch -gb
  1823. Revision 1.14 1998/05/11 13:07:56 peter
  1824. + $ifdef NEWPPU for the new ppuformat
  1825. + $define GDB not longer required
  1826. * removed all warnings and stripped some log comments
  1827. * no findfirst/findnext anymore to remove smartlink *.o files
  1828. Revision 1.13 1998/05/06 08:38:45 pierre
  1829. * better position info with UseTokenInfo
  1830. UseTokenInfo greatly simplified
  1831. + added check for changed tree after first time firstpass
  1832. (if we could remove all the cases were it happen
  1833. we could skip all firstpass if firstpasscount > 1)
  1834. Only with ExtDebug
  1835. Revision 1.12 1998/05/05 12:05:42 florian
  1836. * problems with properties fixed
  1837. * crash fixed: i:=l when i and l are undefined, was a problem with
  1838. implementation of private/protected
  1839. Revision 1.11 1998/05/04 11:22:26 florian
  1840. * problem with DOM solved: it crashes when accessing a property in a method
  1841. Revision 1.10 1998/05/01 16:38:45 florian
  1842. * handling of private and protected fixed
  1843. + change_keywords_to_tp implemented to remove
  1844. keywords which aren't supported by tp
  1845. * break and continue are now symbols of the system unit
  1846. + widestring, longstring and ansistring type released
  1847. Revision 1.9 1998/04/29 10:33:58 pierre
  1848. + added some code for ansistring (not complete nor working yet)
  1849. * corrected operator overloading
  1850. * corrected nasm output
  1851. + started inline procedures
  1852. + added starstarn : use ** for exponentiation (^ gave problems)
  1853. + started UseTokenInfo cond to get accurate positions
  1854. Revision 1.8 1998/04/14 23:27:03 florian
  1855. + exclude/include with constant second parameter added
  1856. Revision 1.7 1998/04/09 23:02:15 florian
  1857. * small problems solved to get remake3 work
  1858. Revision 1.6 1998/04/09 22:16:35 florian
  1859. * problem with previous REGALLOC solved
  1860. * improved property support
  1861. Revision 1.5 1998/04/08 10:26:09 florian
  1862. * correct error handling of virtual constructors
  1863. * problem with new type declaration handling fixed
  1864. Revision 1.4 1998/04/07 22:45:05 florian
  1865. * bug0092, bug0115 and bug0121 fixed
  1866. + packed object/class/array
  1867. Revision 1.3 1998/04/07 13:19:46 pierre
  1868. * bugfixes for reset_gdb_info
  1869. in MEM parsing for go32v2
  1870. better external symbol creation
  1871. support for rhgdb.exe (lowercase file names)
  1872. }