pexpr.pas 97 KB

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