pexpr.pas 82 KB

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