pexpr.pas 78 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983
  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. const
  1490. tok2node:array[PLUS.._XOR] of Ttreetyp=
  1491. (addn,subn,muln,slashn,equaln,gtn,ltn,gten,lten,
  1492. isn,asn,inn,
  1493. symdifn,starstarn,nothingn,caretn,unequaln,nothingn,
  1494. nothingn,nothingn,nothingn,nothingn,nothingn,
  1495. nothingn,nothingn,nothingn,nothingn,nothingn,
  1496. nothingn,nothingn,nothingn,nothingn,nothingn,
  1497. nothingn,andn,nothingn,nothingn,nothingn,
  1498. nothingn,nothingn,nothingn,nothingn,nothingn,
  1499. nothingn,nothingn,divn,nothingn,nothingn,
  1500. nothingn,nothingn,nothingn,nothingn,nothingn,
  1501. nothingn,nothingn,nothingn,nothingn,nothingn,
  1502. nothingn,nothingn,nothingn,nothingn,nothingn,
  1503. modn,nothingn,nothingn,nothingn,nothingn,
  1504. nothingn,nothingn,orn,
  1505. nothingn,nothingn,nothingn,nothingn,nothingn,
  1506. nothingn,nothingn,shln,shrn,
  1507. nothingn,nothingn,nothingn,nothingn,nothingn,
  1508. nothingn,nothingn,nothingn,nothingn,nothingn,
  1509. nothingn,xorn);
  1510. operator_levels:array[Toperator_precedence] of set of Ttoken=
  1511. ([LT,LTE,GT,GTE,EQUAL,UNEQUAL,_IN,_IS],
  1512. [PLUS,MINUS,_OR,_XOR],
  1513. [CARET,SYMDIF,STARSTAR,STAR,SLASH,_DIV,_MOD,_AND,_SHL,_SHR,_AS]);
  1514. function sub_expr(pred_level:Toperator_precedence;accept_equal : boolean):Ptree;
  1515. {Reads a subexpression while the operators are of the current precedence
  1516. level, or any higher level. Replaces the old term, simpl_expr and
  1517. simpl2_expr.}
  1518. var p1,p2:Ptree;
  1519. oldt:Ttoken;
  1520. filepos : tfileposinfo;
  1521. begin
  1522. { if pred_level=high(Toperator_precedence) then }
  1523. if pred_level=opmultiply then
  1524. { this IS wrong !!! PM
  1525. p1:=factor(getprocvar)}
  1526. p1:=factor(false)
  1527. else
  1528. p1:=sub_expr(succ(pred_level),true);
  1529. repeat
  1530. { aweful hack to support const a : 1..2=1; }
  1531. { disadvantage of tables :) FK }
  1532. if (token in operator_levels[pred_level]) and
  1533. ((token<>EQUAL) or accept_equal) then
  1534. begin
  1535. oldt:=token;
  1536. filepos:=tokenpos;
  1537. consume(token);
  1538. { if pred_level=high(Toperator_precedence) then }
  1539. if pred_level=opmultiply then
  1540. p2:=factor(false)
  1541. else
  1542. p2:=sub_expr(succ(pred_level),true);
  1543. p1:=gennode(tok2node[oldt],p1,p2);
  1544. set_tree_filepos(p1,filepos);
  1545. end
  1546. else
  1547. break;
  1548. until false;
  1549. sub_expr:=p1;
  1550. end;
  1551. function comp_expr(accept_equal : boolean):Ptree;
  1552. var
  1553. oldafterassignment : boolean;
  1554. begin
  1555. oldafterassignment:=afterassignment;
  1556. afterassignment:=true;
  1557. comp_expr:=sub_expr(opcompare,accept_equal);
  1558. afterassignment:=oldafterassignment;
  1559. end;
  1560. function expr : ptree;
  1561. var
  1562. p1,p2 : ptree;
  1563. oldafterassignment : boolean;
  1564. oldp1 : ptree;
  1565. filepos : tfileposinfo;
  1566. begin
  1567. oldafterassignment:=afterassignment;
  1568. p1:=sub_expr(opcompare,true);
  1569. if token in [ASSIGNMENT,_PLUSASN,_MINUSASN,_STARASN,_SLASHASN] then
  1570. afterassignment:=true;
  1571. filepos:=tokenpos;
  1572. oldp1:=p1;
  1573. case token of
  1574. POINTPOINT : begin
  1575. consume(POINTPOINT);
  1576. p2:=sub_expr(opcompare,true);
  1577. p1:=gennode(rangen,p1,p2);
  1578. end;
  1579. ASSIGNMENT : begin
  1580. consume(ASSIGNMENT);
  1581. { avoid a firstpass of a procedure if
  1582. it must be assigned to a procvar }
  1583. { should be recursive for a:=b:=c !!! }
  1584. if (p1^.resulttype<>nil) and (p1^.resulttype^.deftype=procvardef) then
  1585. begin
  1586. getprocvar:=true;
  1587. getprocvardef:=pprocvardef(p1^.resulttype);
  1588. end;
  1589. p2:=sub_expr(opcompare,true);
  1590. if getprocvar and (p2^.treetype=calln) and
  1591. (proc_to_procvar_equal(getprocvardef,pprocsym(p2^.symtableentry)^.definition)) then
  1592. begin
  1593. p2^.treetype:=loadn;
  1594. p2^.resulttype:=pprocsym(p2^.symtableprocentry)^.definition;
  1595. p2^.symtableentry:=p2^.symtableprocentry;
  1596. end;
  1597. getprocvar:=false;
  1598. p1:=gennode(assignn,p1,p2);
  1599. end;
  1600. { this is the code for C like assignements }
  1601. { from an improvement of Peter Schaefer }
  1602. _PLUSASN : begin
  1603. consume(_PLUSASN );
  1604. p2:=sub_expr(opcompare,true);
  1605. p1:=gennode(assignn,p1,gennode(addn,getcopy(p1),p2));
  1606. { was first
  1607. p1:=gennode(assignn,p1,gennode(addn,p1,p2));
  1608. but disposetree assumes that we have a real
  1609. *** tree *** }
  1610. end;
  1611. _MINUSASN : begin
  1612. consume(_MINUSASN );
  1613. p2:=sub_expr(opcompare,true);
  1614. p1:=gennode(assignn,p1,gennode(subn,getcopy(p1),p2));
  1615. end;
  1616. _STARASN : begin
  1617. consume(_STARASN );
  1618. p2:=sub_expr(opcompare,true);
  1619. p1:=gennode(assignn,p1,gennode(muln,getcopy(p1),p2));
  1620. end;
  1621. _SLASHASN : begin
  1622. consume(_SLASHASN );
  1623. p2:=sub_expr(opcompare,true);
  1624. p1:=gennode(assignn,p1,gennode(slashn,getcopy(p1),p2));
  1625. end;
  1626. end;
  1627. afterassignment:=oldafterassignment;
  1628. if p1<>oldp1 then
  1629. set_tree_filepos(p1,filepos);
  1630. expr:=p1;
  1631. end;
  1632. function get_intconst:longint;
  1633. {Reads an expression, tries to evalute it and check if it is an integer
  1634. constant. Then the constant is returned.}
  1635. var
  1636. p:Ptree;
  1637. begin
  1638. p:=comp_expr(true);
  1639. do_firstpass(p);
  1640. if (p^.treetype<>ordconstn) and
  1641. (p^.resulttype^.deftype=orddef) and
  1642. not(Porddef(p^.resulttype)^.typ in [uvoid,uchar,bool8bit,bool16bit,bool32bit]) then
  1643. Message(cg_e_illegal_expression)
  1644. else
  1645. get_intconst:=p^.value;
  1646. disposetree(p);
  1647. end;
  1648. function get_stringconst:string;
  1649. {Reads an expression, tries to evaluate it and checks if it is a string
  1650. constant. Then the constant is returned.}
  1651. var
  1652. p:Ptree;
  1653. begin
  1654. get_stringconst:='';
  1655. p:=comp_expr(true);
  1656. do_firstpass(p);
  1657. if p^.treetype<>stringconstn then
  1658. begin
  1659. if (p^.treetype=ordconstn) and
  1660. (p^.resulttype^.deftype=orddef) and
  1661. (Porddef(p^.resulttype)^.typ=uchar) then
  1662. get_stringconst:=char(p^.value)
  1663. else
  1664. Message(cg_e_illegal_expression);
  1665. end
  1666. else
  1667. get_stringconst:=p^.value_str^;
  1668. disposetree(p);
  1669. end;
  1670. end.
  1671. {
  1672. $Log$
  1673. Revision 1.55 1998-09-24 23:49:10 peter
  1674. + aktmodeswitches
  1675. Revision 1.54 1998/09/23 15:46:39 florian
  1676. * problem with with and classes fixed
  1677. Revision 1.53 1998/09/23 09:58:54 peter
  1678. * first working array of const things
  1679. Revision 1.52 1998/09/20 09:38:45 florian
  1680. * hasharray for defs fixed
  1681. * ansistring code generation corrected (init/final, assignement)
  1682. Revision 1.51 1998/09/18 16:03:43 florian
  1683. * some changes to compile with Delphi
  1684. Revision 1.50 1998/09/17 13:41:18 pierre
  1685. sizeof(TPOINT) problem
  1686. Revision 1.49.2.1 1998/09/17 08:42:31 pierre
  1687. TPOINT sizeof fix
  1688. Revision 1.49 1998/09/09 11:50:53 pierre
  1689. * forward def are not put in record or objects
  1690. + added check for forwards also in record and objects
  1691. * dummy parasymtable for unit initialization removed from
  1692. symtable stack
  1693. Revision 1.48 1998/09/07 22:25:53 peter
  1694. * fixed str(boolean,string) which was allowed
  1695. * fixed write(' ':<int expression>) only constants where allowed :(
  1696. Revision 1.47 1998/09/07 18:46:10 peter
  1697. * update smartlinking, uses getdatalabel
  1698. * renamed ptree.value vars to value_str,value_real,value_set
  1699. Revision 1.46 1998/09/04 08:42:03 peter
  1700. * updated some error messages
  1701. Revision 1.45 1998/09/01 17:39:49 peter
  1702. + internal constant functions
  1703. Revision 1.44 1998/08/28 10:54:24 peter
  1704. * fixed smallset generation from elements, it has never worked before!
  1705. Revision 1.43 1998/08/23 16:07:24 florian
  1706. * internalerror with mod/div fixed
  1707. Revision 1.42 1998/08/21 14:08:50 pierre
  1708. + TEST_FUNCRET now default (old code removed)
  1709. works also for m68k (at least compiles)
  1710. Revision 1.41 1998/08/20 21:36:39 peter
  1711. * fixed 'with object do' bug
  1712. Revision 1.40 1998/08/20 09:26:41 pierre
  1713. + funcret setting in underproc testing
  1714. compile with _dTEST_FUNCRET
  1715. Revision 1.39 1998/08/18 16:48:48 pierre
  1716. * bug for -So proc assignment to p^rocvar fixed
  1717. Revision 1.38 1998/08/18 14:17:09 pierre
  1718. * bug about assigning the return value of a function to
  1719. a procvar fixed : warning
  1720. assigning a proc to a procvar need @ in FPC mode !!
  1721. * missing file/line info restored
  1722. Revision 1.37 1998/08/18 09:24:43 pierre
  1723. * small warning position bug fixed
  1724. * support_mmx switches splitting was missing
  1725. * rhide error and warning output corrected
  1726. Revision 1.36 1998/08/15 16:50:29 peter
  1727. * fixed proc()=expr which was not allowed anymore by my previous fix
  1728. Revision 1.35 1998/08/14 18:18:46 peter
  1729. + dynamic set contruction
  1730. * smallsets are now working (always longint size)
  1731. Revision 1.34 1998/08/13 11:00:12 peter
  1732. * fixed procedure<>procedure construct
  1733. Revision 1.33 1998/08/11 15:31:39 peter
  1734. * write extended to ppu file
  1735. * new version 0.99.7
  1736. Revision 1.32 1998/08/11 14:05:32 peter
  1737. * fixed sizeof(array of char)
  1738. Revision 1.31 1998/08/10 14:50:11 peter
  1739. + localswitches, moduleswitches, globalswitches splitting
  1740. Revision 1.30 1998/07/28 21:52:54 florian
  1741. + implementation of raise and try..finally
  1742. + some misc. exception stuff
  1743. Revision 1.29 1998/07/27 21:57:13 florian
  1744. * fix to allow tv like stream registration:
  1745. @tmenu.load doesn't work if load had parameters or if load was only
  1746. declared in an anchestor class of tmenu
  1747. Revision 1.28 1998/07/14 21:46:51 peter
  1748. * updated messages file
  1749. Revision 1.27 1998/06/25 14:04:23 peter
  1750. + internal inc/dec
  1751. Revision 1.26 1998/06/09 16:01:46 pierre
  1752. + added procedure directive parsing for procvars
  1753. (accepted are popstack cdecl and pascal)
  1754. + added C vars with the following syntax
  1755. var C calias 'true_c_name';(can be followed by external)
  1756. reason is that you must add the Cprefix
  1757. which is target dependent
  1758. Revision 1.25 1998/06/05 14:37:33 pierre
  1759. * fixes for inline for operators
  1760. * inline procedure more correctly restricted
  1761. Revision 1.24 1998/06/04 23:51:52 peter
  1762. * m68k compiles
  1763. + .def file creation moved to gendef.pas so it could also be used
  1764. for win32
  1765. Revision 1.23 1998/06/04 09:55:40 pierre
  1766. * demangled name of procsym reworked to become independant of the mangling scheme
  1767. Revision 1.22 1998/06/02 17:03:03 pierre
  1768. * with node corrected for objects
  1769. * small bugs for SUPPORT_MMX fixed
  1770. Revision 1.21 1998/05/27 19:45:05 peter
  1771. * symtable.pas splitted into includefiles
  1772. * symtable adapted for $ifdef NEWPPU
  1773. Revision 1.20 1998/05/26 07:53:59 pierre
  1774. * bug fix for empty sets (nil pd was dereferenced )
  1775. Revision 1.19 1998/05/25 17:11:43 pierre
  1776. * firstpasscount bug fixed
  1777. now all is already set correctly the first time
  1778. under EXTDEBUG try -gp to skip all other firstpasses
  1779. it works !!
  1780. * small bug fixes
  1781. - for smallsets with -dTESTSMALLSET
  1782. - some warnings removed (by correcting code !)
  1783. Revision 1.18 1998/05/23 01:21:20 peter
  1784. + aktasmmode, aktoptprocessor, aktoutputformat
  1785. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  1786. + $LIBNAME to set the library name where the unit will be put in
  1787. * splitted cgi386 a bit (codeseg to large for bp7)
  1788. * nasm, tasm works again. nasm moved to ag386nsm.pas
  1789. Revision 1.17 1998/05/22 12:37:03 carl
  1790. * crash bugfix (patched msanually to main branch)
  1791. Revision 1.16 1998/05/21 19:33:32 peter
  1792. + better procedure directive handling and only one table
  1793. Revision 1.15 1998/05/20 09:42:35 pierre
  1794. + UseTokenInfo now default
  1795. * unit in interface uses and implementation uses gives error now
  1796. * only one error for unknown symbol (uses lastsymknown boolean)
  1797. the problem came from the label code !
  1798. + first inlined procedures and function work
  1799. (warning there might be allowed cases were the result is still wrong !!)
  1800. * UseBrower updated gives a global list of all position of all used symbols
  1801. with switch -gb
  1802. Revision 1.14 1998/05/11 13:07:56 peter
  1803. + $ifdef NEWPPU for the new ppuformat
  1804. + $define GDB not longer required
  1805. * removed all warnings and stripped some log comments
  1806. * no findfirst/findnext anymore to remove smartlink *.o files
  1807. Revision 1.13 1998/05/06 08:38:45 pierre
  1808. * better position info with UseTokenInfo
  1809. UseTokenInfo greatly simplified
  1810. + added check for changed tree after first time firstpass
  1811. (if we could remove all the cases were it happen
  1812. we could skip all firstpass if firstpasscount > 1)
  1813. Only with ExtDebug
  1814. Revision 1.12 1998/05/05 12:05:42 florian
  1815. * problems with properties fixed
  1816. * crash fixed: i:=l when i and l are undefined, was a problem with
  1817. implementation of private/protected
  1818. Revision 1.11 1998/05/04 11:22:26 florian
  1819. * problem with DOM solved: it crashes when accessing a property in a method
  1820. Revision 1.10 1998/05/01 16:38:45 florian
  1821. * handling of private and protected fixed
  1822. + change_keywords_to_tp implemented to remove
  1823. keywords which aren't supported by tp
  1824. * break and continue are now symbols of the system unit
  1825. + widestring, longstring and ansistring type released
  1826. Revision 1.9 1998/04/29 10:33:58 pierre
  1827. + added some code for ansistring (not complete nor working yet)
  1828. * corrected operator overloading
  1829. * corrected nasm output
  1830. + started inline procedures
  1831. + added starstarn : use ** for exponentiation (^ gave problems)
  1832. + started UseTokenInfo cond to get accurate positions
  1833. Revision 1.8 1998/04/14 23:27:03 florian
  1834. + exclude/include with constant second parameter added
  1835. Revision 1.7 1998/04/09 23:02:15 florian
  1836. * small problems solved to get remake3 work
  1837. Revision 1.6 1998/04/09 22:16:35 florian
  1838. * problem with previous REGALLOC solved
  1839. * improved property support
  1840. Revision 1.5 1998/04/08 10:26:09 florian
  1841. * correct error handling of virtual constructors
  1842. * problem with new type declaration handling fixed
  1843. Revision 1.4 1998/04/07 22:45:05 florian
  1844. * bug0092, bug0115 and bug0121 fixed
  1845. + packed object/class/array
  1846. Revision 1.3 1998/04/07 13:19:46 pierre
  1847. * bugfixes for reset_gdb_info
  1848. in MEM parsing for go32v2
  1849. better external symbol creation
  1850. support for rhgdb.exe (lowercase file names)
  1851. }