pexpr.pas 81 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017
  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,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(sym_e_type_mismatch);
  130. statement_syssym:=genzeronode(errorn);
  131. end
  132. else
  133. if p1^.resulttype^.deftype=objectdef then
  134. statement_syssym:=geninlinenode(in_typeof_x,p1)
  135. else
  136. begin
  137. Message(sym_e_type_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(sym_e_type_mismatch);
  148. statement_syssym:=genzeronode(errorn)
  149. end
  150. else
  151. if p1^.resulttype^.deftype=objectdef then
  152. statement_syssym:=geninlinenode(in_typeof_x,p1)
  153. else
  154. begin
  155. Message(sym_e_type_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) or
  177. is_open_array(p1^.resulttype) then
  178. statement_syssym:=geninlinenode(in_sizeof_x,p1)
  179. else
  180. begin
  181. statement_syssym:=genordinalconstnode(p1^.resulttype^.size,pd);
  182. { p1 not needed !}
  183. disposetree(p1);
  184. end;
  185. end;
  186. end;
  187. in_assigned_x : begin
  188. consume(LKLAMMER);
  189. in_args:=true;
  190. p1:=comp_expr(true);
  191. Must_be_valid:=true;
  192. do_firstpass(p1);
  193. case p1^.resulttype^.deftype of
  194. pointerdef,
  195. procvardef,
  196. classrefdef : ;
  197. objectdef : if not(pobjectdef(p1^.resulttype)^.isclass) then
  198. Message(parser_e_illegal_parameter_list);
  199. else
  200. Message(parser_e_illegal_parameter_list);
  201. end;
  202. p2:=gencallparanode(p1,nil);
  203. p2:=geninlinenode(in_assigned_x,p2);
  204. consume(RKLAMMER);
  205. pd:=booldef;
  206. statement_syssym:=p2;
  207. end;
  208. in_ofs_x : begin
  209. consume(LKLAMMER);
  210. in_args:=true;
  211. p1:=comp_expr(true);
  212. p1:=gensinglenode(addrn,p1);
  213. Must_be_valid:=false;
  214. do_firstpass(p1);
  215. { Ofs() returns a longint, not a pointer }
  216. p1^.resulttype:=u32bitdef;
  217. pd:=p1^.resulttype;
  218. consume(RKLAMMER);
  219. statement_syssym:=p1;
  220. end;
  221. in_seg_x : begin
  222. consume(LKLAMMER);
  223. in_args:=true;
  224. p1:=comp_expr(true);
  225. do_firstpass(p1);
  226. if p1^.location.loc<>LOC_REFERENCE then
  227. Message(cg_e_illegal_expression);
  228. p1:=genordinalconstnode(0,s32bitdef);
  229. Must_be_valid:=false;
  230. pd:=s32bitdef;
  231. consume(RKLAMMER);
  232. statement_syssym:=p1;
  233. end;
  234. in_high_x,
  235. in_low_x : begin
  236. consume(LKLAMMER);
  237. in_args:=true;
  238. p1:=comp_expr(true);
  239. do_firstpass(p1);
  240. Must_be_valid:=false;
  241. p2:=geninlinenode(l,p1);
  242. consume(RKLAMMER);
  243. pd:=s32bitdef;
  244. statement_syssym:=p2;
  245. end;
  246. in_succ_x,
  247. in_pred_x : begin
  248. consume(LKLAMMER);
  249. in_args:=true;
  250. p1:=comp_expr(true);
  251. do_firstpass(p1);
  252. Must_be_valid:=false;
  253. p2:=geninlinenode(l,p1);
  254. consume(RKLAMMER);
  255. pd:=p1^.resulttype;
  256. statement_syssym:=p2;
  257. end;
  258. in_inc_x,
  259. in_dec_x : begin
  260. consume(LKLAMMER);
  261. in_args:=true;
  262. p1:=comp_expr(true);
  263. Must_be_valid:=false;
  264. if token=COMMA then
  265. begin
  266. consume(COMMA);
  267. p2:=gencallparanode(comp_expr(true),nil);
  268. end
  269. else
  270. p2:=nil;
  271. p2:=gencallparanode(p1,p2);
  272. statement_syssym:=geninlinenode(l,p2);
  273. consume(RKLAMMER);
  274. pd:=voiddef;
  275. end;
  276. in_concat_x : begin
  277. consume(LKLAMMER);
  278. in_args:=true;
  279. p2:=nil;
  280. while true do
  281. begin
  282. p1:=comp_expr(true);
  283. Must_be_valid:=true;
  284. do_firstpass(p1);
  285. if not((p1^.resulttype^.deftype=stringdef) or
  286. ((p1^.resulttype^.deftype=orddef) and
  287. (porddef(p1^.resulttype)^.typ=uchar))) then
  288. Message(parser_e_illegal_parameter_list);
  289. if p2<>nil then
  290. p2:=gennode(addn,p2,p1)
  291. else
  292. p2:=p1;
  293. if token=COMMA then
  294. consume(COMMA)
  295. else
  296. break;
  297. end;
  298. consume(RKLAMMER);
  299. pd:=cstringdef;
  300. statement_syssym:=p2;
  301. end;
  302. in_read_x,
  303. in_readln_x : begin
  304. if token=LKLAMMER then
  305. begin
  306. consume(LKLAMMER);
  307. in_args:=true;
  308. Must_be_valid:=false;
  309. paras:=parse_paras(false,false);
  310. consume(RKLAMMER);
  311. end
  312. else
  313. paras:=nil;
  314. pd:=voiddef;
  315. p1:=geninlinenode(l,paras);
  316. do_firstpass(p1);
  317. statement_syssym := p1;
  318. end;
  319. in_write_x,
  320. in_writeln_x : begin
  321. if token=LKLAMMER then
  322. begin
  323. consume(LKLAMMER);
  324. in_args:=true;
  325. Must_be_valid:=true;
  326. paras:=parse_paras(true,false);
  327. consume(RKLAMMER);
  328. end
  329. else
  330. paras:=nil;
  331. pd:=voiddef;
  332. p1 := geninlinenode(l,paras);
  333. do_firstpass(p1);
  334. statement_syssym := p1;
  335. end;
  336. in_str_x_string : begin
  337. consume(LKLAMMER);
  338. in_args:=true;
  339. paras:=parse_paras(true,false);
  340. consume(RKLAMMER);
  341. p1 := geninlinenode(l,paras);
  342. do_firstpass(p1);
  343. statement_syssym := p1;
  344. pd:=voiddef;
  345. end;
  346. in_include_x_y,
  347. in_exclude_x_y : begin
  348. consume(LKLAMMER);
  349. in_args:=true;
  350. p1:=comp_expr(true);
  351. Must_be_valid:=false;
  352. consume(COMMA);
  353. p2:=comp_expr(true);
  354. { just a bit lisp feeling }
  355. statement_syssym:=geninlinenode(l,
  356. 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,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(sym_e_type_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_read_set
  617. ****************************************************************************}
  618. { Read a set between [] }
  619. function factor_read_set:ptree;
  620. var
  621. constp,
  622. buildp,
  623. p2,p3,p4 : ptree;
  624. pd : pdef;
  625. constset : pconstset;
  626. constsetlo,
  627. constsethi : longint;
  628. procedure update_constsethi(p:pdef);
  629. begin
  630. if ((p^.deftype=orddef) and
  631. (porddef(p)^.high>constsethi)) then
  632. constsethi:=porddef(p)^.high
  633. else
  634. if ((p^.deftype=enumdef) and
  635. (penumdef(p)^.max>constsethi)) then
  636. constsethi:=penumdef(p)^.max;
  637. end;
  638. procedure do_set(pos : longint);
  639. var
  640. mask,l : longint;
  641. begin
  642. if (pos>255) or (pos<0) then
  643. Message(parser_e_illegal_set_expr);
  644. if pos>constsethi then
  645. constsethi:=pos;
  646. if pos<constsetlo then
  647. constsetlo:=pos;
  648. l:=pos shr 3;
  649. mask:=1 shl (pos mod 8);
  650. { do we allow the same twice }
  651. if (constset^[l] and mask)<>0 then
  652. Message(parser_e_illegal_set_expr);
  653. constset^[l]:=constset^[l] or mask;
  654. end;
  655. var
  656. l : longint;
  657. begin
  658. new(constset);
  659. FillChar(constset^,sizeof(constset^),0);
  660. constsetlo:=0;
  661. constsethi:=0;
  662. constp:=gensinglenode(setconstrn,nil);
  663. constp^.constset:=constset;
  664. buildp:=constp;
  665. pd:=nil;
  666. if token<>RECKKLAMMER then
  667. begin
  668. while true do
  669. begin
  670. p4:=nil; { will contain the tree to create the set }
  671. p2:=comp_expr(true);
  672. do_firstpass(p2);
  673. if codegenerror then
  674. break;
  675. case p2^.resulttype^.deftype of
  676. enumdef,
  677. orddef : begin
  678. if (p2^.resulttype^.deftype=orddef) and
  679. (porddef(p2^.resulttype)^.typ in [s8bit,s16bit,s32bit,u16bit,u32bit]) then
  680. begin
  681. p2:=gentypeconvnode(p2,u8bitdef);
  682. do_firstpass(p2);
  683. end;
  684. { set settype result }
  685. if pd=nil then
  686. pd:=p2^.resulttype;
  687. if not(is_equal(pd,p2^.resulttype)) then
  688. begin
  689. Message(parser_e_typeconflict_in_set);
  690. disposetree(p2);
  691. end
  692. else
  693. begin
  694. if token=POINTPOINT then
  695. begin
  696. consume(POINTPOINT);
  697. p3:=comp_expr(true);
  698. do_firstpass(p3);
  699. if codegenerror then
  700. break;
  701. if (p3^.resulttype^.deftype=orddef) and
  702. (porddef(p3^.resulttype)^.typ in [s8bit,s16bit,s32bit,u16bit,u32bit]) then
  703. begin
  704. p3:=gentypeconvnode(p3,u8bitdef);
  705. do_firstpass(p3);
  706. end;
  707. if not(is_equal(pd,p3^.resulttype)) then
  708. Message(parser_e_typeconflict_in_set)
  709. else
  710. begin
  711. if (p2^.treetype=ordconstn) and (p3^.treetype=ordconstn) then
  712. begin
  713. for l:=p2^.value to p3^.value do
  714. do_set(l);
  715. disposetree(p3);
  716. disposetree(p2);
  717. end
  718. else
  719. begin
  720. update_constsethi(p3^.resulttype);
  721. p4:=gennode(rangen,p2,p3);
  722. end;
  723. end;
  724. end
  725. else
  726. begin
  727. { Single value }
  728. if p2^.treetype=ordconstn then
  729. begin
  730. do_set(p2^.value);
  731. disposetree(p2);
  732. end
  733. else
  734. begin
  735. update_constsethi(p2^.resulttype);
  736. p4:=gensinglenode(setelen,p2);
  737. end;
  738. end;
  739. end;
  740. end;
  741. stringdef : begin
  742. if pd=nil then
  743. pd:=cchardef;
  744. if not(is_equal(pd,cchardef)) then
  745. Message(parser_e_typeconflict_in_set)
  746. else
  747. for l:=1 to length(pstring(p2^.values)^) do
  748. do_set(ord(pstring(p2^.values)^[l]));
  749. disposetree(p2);
  750. end;
  751. else
  752. Internalerror(4234);
  753. end;
  754. { insert the set creation tree }
  755. if assigned(p4) then
  756. begin
  757. buildp:=gennode(addn,buildp,p4);
  758. end;
  759. { there could be more elements }
  760. if token=COMMA then
  761. consume(COMMA)
  762. else
  763. break;
  764. end;
  765. end;
  766. constp^.resulttype:=new(psetdef,init(pd,constsethi));
  767. factor_read_set:=buildp;
  768. end;
  769. {****************************************************************************
  770. Factor
  771. ****************************************************************************}
  772. function factor(getaddr : boolean) : ptree;
  773. var
  774. l : longint;
  775. p1,p2,p3 : ptree;
  776. code : word;
  777. pd,pd2 : pdef;
  778. unit_specific, again : boolean;
  779. static_name : string;
  780. sym : pvarsym;
  781. classh : pobjectdef;
  782. d : bestreal;
  783. propsym : ppropertysym;
  784. oldp1 : ptree;
  785. filepos : tfileposinfo;
  786. procedure check_tokenpos;
  787. begin
  788. if (p1<>oldp1) then
  789. begin
  790. if assigned(p1) then
  791. set_tree_filepos(p1,filepos);
  792. oldp1:=p1;
  793. filepos:=tokenpos;
  794. end;
  795. end;
  796. procedure postfixoperators;
  797. { p1 and p2 must contain valid values }
  798. begin
  799. check_tokenpos;
  800. while again do
  801. begin
  802. case token of
  803. CARET : begin
  804. consume(CARET);
  805. if pd^.deftype<>pointerdef then
  806. begin
  807. { ^ as binary operator is a problem!!!! (FK) }
  808. again:=false;
  809. Message(cg_e_invalid_qualifier);
  810. disposetree(p1);
  811. p1:=genzeronode(errorn);
  812. end
  813. else
  814. begin
  815. p1:=gensinglenode(derefn,p1);
  816. pd:=ppointerdef(pd)^.definition;
  817. end;
  818. end;
  819. LECKKLAMMER : begin
  820. if (pd^.deftype=objectdef) and pobjectdef(pd)^.isclass then
  821. begin
  822. { default property }
  823. propsym:=search_default_property(pobjectdef(pd));
  824. if not(assigned(propsym)) then
  825. begin
  826. disposetree(p1);
  827. p1:=genzeronode(errorn);
  828. again:=false;
  829. message(parser_e_no_default_property_available);
  830. end
  831. else
  832. begin
  833. p1:=nil;
  834. handle_propertysym(propsym,p1,pd);
  835. end;
  836. end
  837. else
  838. begin
  839. consume(LECKKLAMMER);
  840. repeat
  841. case pd^.deftype of
  842. pointerdef : begin
  843. p2:=comp_expr(true);
  844. p1:=gennode(vecn,p1,p2);
  845. pd:=ppointerdef(pd)^.definition;
  846. end;
  847. stringdef : begin
  848. p2:=comp_expr(true);
  849. p1:=gennode(vecn,p1,p2);
  850. pd:=cchardef
  851. end;
  852. arraydef : begin
  853. p2:=comp_expr(true);
  854. {$ifdef i386}
  855. { support SEG:OFS for go32v2 Mem[] }
  856. if (target_info.target=target_GO32V2) and
  857. (p1^.treetype=loadn) and
  858. assigned(p1^.symtableentry) and
  859. assigned(p1^.symtableentry^.owner^.name) and
  860. (p1^.symtableentry^.owner^.name^='SYSTEM') and
  861. ((p1^.symtableentry^.name='MEM') or
  862. (p1^.symtableentry^.name='MEMW') or
  863. (p1^.symtableentry^.name='MEML')) then
  864. begin
  865. if (token=COLON) then
  866. begin
  867. consume(COLON);
  868. p3:=gennode(muln,genordinalconstnode($10,s32bitdef),p2);
  869. p2:=comp_expr(true);
  870. p2:=gennode(addn,p2,p3);
  871. p1:=gennode(vecn,p1,p2);
  872. p1^.memseg:=true;
  873. p1^.memindex:=true;
  874. end
  875. else
  876. begin
  877. p1:=gennode(vecn,p1,p2);
  878. p1^.memindex:=true;
  879. end;
  880. end
  881. else
  882. {$endif}
  883. p1:=gennode(vecn,p1,p2);
  884. pd:=parraydef(pd)^.definition;
  885. end;
  886. else
  887. begin
  888. Message(cg_e_invalid_qualifier);
  889. disposetree(p1);
  890. p1:=genzeronode(errorn);
  891. again:=false;
  892. end;
  893. end;
  894. if token=COMMA then
  895. consume(COMMA)
  896. else
  897. break;
  898. until false;
  899. consume(RECKKLAMMER);
  900. end;
  901. end;
  902. POINT : begin
  903. consume(POINT);
  904. case pd^.deftype of
  905. recorddef : begin
  906. sym:=pvarsym(precdef(pd)^.symtable^.search(pattern));
  907. consume(ID);
  908. if sym=nil then
  909. begin
  910. Message(sym_e_illegal_field);
  911. disposetree(p1);
  912. p1:=genzeronode(errorn);
  913. end
  914. else
  915. begin
  916. p1:=gensubscriptnode(sym,p1);
  917. pd:=sym^.definition;
  918. end;
  919. end;
  920. classrefdef : begin
  921. classh:=pobjectdef(pclassrefdef(pd)^.definition);
  922. sym:=nil;
  923. while assigned(classh) do
  924. begin
  925. sym:=pvarsym(classh^.publicsyms^.search(pattern));
  926. srsymtable:=classh^.publicsyms;
  927. if assigned(sym) then
  928. break;
  929. classh:=classh^.childof;
  930. end;
  931. consume(ID);
  932. do_member_read(false,sym,p1,pd,again);
  933. end;
  934. objectdef : begin
  935. classh:=pobjectdef(pd);
  936. sym:=nil;
  937. while assigned(classh) do
  938. begin
  939. sym:=pvarsym(classh^.publicsyms^.search(pattern));
  940. srsymtable:=classh^.publicsyms;
  941. if assigned(sym) then
  942. break;
  943. classh:=classh^.childof;
  944. end;
  945. consume(ID);
  946. do_member_read(false,sym,p1,pd,again);
  947. end;
  948. pointerdef : begin
  949. Message(cg_e_invalid_qualifier);
  950. if ppointerdef(pd)^.definition^.deftype in [recorddef,objectdef,classrefdef] then
  951. Message(parser_h_maybe_deref_caret_missing);
  952. end;
  953. else
  954. begin
  955. Message(cg_e_invalid_qualifier);
  956. disposetree(p1);
  957. p1:=genzeronode(errorn);
  958. end;
  959. end;
  960. end;
  961. else
  962. begin
  963. { is this a procedure variable ? }
  964. if assigned(pd) then
  965. begin
  966. if (pd^.deftype=procvardef) then
  967. begin
  968. if getprocvar and proc_to_procvar_equal(pprocvardef(pd),getprocvardef) then
  969. again:=false
  970. else
  971. if (token=LKLAMMER) or
  972. ((pprocvardef(pd)^.para1=nil) and
  973. (not((token in [ASSIGNMENT,UNEQUAL,EQUAL]))) and
  974. (not afterassignment) and
  975. (not in_args)) then
  976. begin
  977. { do this in a strange way }
  978. { it's not a clean solution }
  979. p2:=p1;
  980. p1:=gencallnode(nil,nil);
  981. p1^.right:=p2;
  982. p1^.unit_specific:=unit_specific;
  983. p1^.symtableprocentry:=sym;
  984. if token=LKLAMMER then
  985. begin
  986. consume(LKLAMMER);
  987. p1^.left:=parse_paras(false,false);
  988. consume(RKLAMMER);
  989. end;
  990. pd:=pprocvardef(pd)^.retdef;
  991. { proc():= is never possible }
  992. if token=ASSIGNMENT then
  993. begin
  994. Message(cg_e_illegal_expression);
  995. p1:=genzeronode(errorn);
  996. again:=false;
  997. end;
  998. p1^.resulttype:=pd;
  999. end
  1000. else
  1001. again:=false;
  1002. p1^.resulttype:=pd;
  1003. end
  1004. else
  1005. again:=false;
  1006. end
  1007. else
  1008. again:=false;
  1009. end;
  1010. end;
  1011. check_tokenpos;
  1012. end; { while again }
  1013. end;
  1014. {$ifdef TEST_FUNCRET}
  1015. function is_func_ret(sym : psym) : boolean;
  1016. var
  1017. p : pprocinfo;
  1018. begin
  1019. p:=@procinfo;
  1020. is_func_ret:=false;
  1021. while assigned(p) do
  1022. begin
  1023. { is this an access to a function result ? }
  1024. if assigned(aktprocsym) and
  1025. ((sym^.name=aktprocsym^.name){ or
  1026. ((pvarsym(srsym)=opsym) and
  1027. ((p^.flags and pi_operator)<>0))}) and
  1028. (p^.retdef<>pdef(voiddef)) and
  1029. (token<>LKLAMMER) and
  1030. (not ((cs_tp_compatible in aktmoduleswitches) and
  1031. (afterassignment or in_args))) then
  1032. begin
  1033. p1:=genzeronode(funcretn);
  1034. pd:=p^.retdef;
  1035. p1^.funcretprocinfo:=p;
  1036. p1^.retdef:=pd;
  1037. is_func_ret:=true;
  1038. exit;
  1039. end;
  1040. p:=p^.parent;
  1041. end;
  1042. end;
  1043. {$endif TEST_FUNCRET}
  1044. var
  1045. possible_error : boolean;
  1046. begin
  1047. oldp1:=nil;
  1048. filepos:=tokenpos;
  1049. case token of
  1050. ID : begin
  1051. { allow post fix operators }
  1052. again:=true;
  1053. if (cs_delphi2_compatible in aktmoduleswitches) and
  1054. (pattern='RESULT') and
  1055. assigned(aktprocsym) and
  1056. (procinfo.retdef<>pdef(voiddef)) then
  1057. begin
  1058. consume(ID);
  1059. p1:=genzeronode(funcretn);
  1060. pd:=procinfo.retdef;
  1061. {$ifdef TEST_FUNCRET}
  1062. p1^.funcretprocinfo:=pointer(@procinfo);
  1063. p1^.retdef:=pd;
  1064. {$endif TEST_FUNCRET}
  1065. end
  1066. else
  1067. begin
  1068. if lastsymknown then
  1069. begin
  1070. srsym:=lastsrsym;
  1071. srsymtable:=lastsrsymtable;
  1072. lastsymknown:=false;
  1073. end
  1074. else
  1075. getsym(pattern,true);
  1076. consume(ID);
  1077. {$ifndef TEST_FUNCRET}
  1078. { is this an access to a function result ? }
  1079. if assigned(aktprocsym) and
  1080. ((srsym^.name=aktprocsym^.name){ or
  1081. ((pvarsym(srsym)=opsym) and
  1082. ((procinfo.flags and pi_operator)<>0))}) and
  1083. (procinfo.retdef<>pdef(voiddef)) and
  1084. (token<>LKLAMMER) and
  1085. (not ((cs_tp_compatible in aktmoduleswitches) and
  1086. (afterassignment or in_args))) then
  1087. begin
  1088. p1:=genzeronode(funcretn);
  1089. pd:=procinfo.retdef;
  1090. end
  1091. else
  1092. {$else TEST_FUNCRET}
  1093. if not is_func_ret(srsym) then
  1094. {$endif TEST_FUNCRET}
  1095. { else it's a normal symbol }
  1096. begin
  1097. { is it defined like UNIT.SYMBOL ? }
  1098. if srsym^.typ=unitsym then
  1099. begin
  1100. consume(POINT);
  1101. getsymonlyin(punitsym(srsym)^.unitsymtable,pattern);
  1102. unit_specific:=true;
  1103. consume(ID);
  1104. end
  1105. else
  1106. unit_specific:=false;
  1107. if not assigned(srsym) then
  1108. Begin
  1109. p1:=genzeronode(errorn);
  1110. { try to clean up }
  1111. pd:=generrordef;
  1112. end
  1113. else
  1114. Begin
  1115. { check semantics of private }
  1116. if (srsym^.typ in [propertysym,procsym,varsym]) and
  1117. (srsymtable^.symtabletype=objectsymtable) then
  1118. begin
  1119. if ((srsym^.properties and sp_private)<>0) and
  1120. (pobjectdef(srsym^.owner^.defowner)^.owner^.symtabletype=unitsymtable) then
  1121. Message(parser_e_cant_access_private_member);
  1122. end;
  1123. case srsym^.typ of
  1124. absolutesym : begin
  1125. p1:=genloadnode(pvarsym(srsym),srsymtable);
  1126. pd:=pabsolutesym(srsym)^.definition;
  1127. end;
  1128. varsym : begin
  1129. { are we in a class method ? }
  1130. if (srsymtable^.symtabletype=objectsymtable) and
  1131. assigned(aktprocsym) and
  1132. ((aktprocsym^.definition^.options and poclassmethod)<>0) then
  1133. Message(parser_e_only_class_methods);
  1134. if (srsym^.properties and sp_static)<>0 then
  1135. begin
  1136. static_name:=lower(srsymtable^.name^)+'_'+srsym^.name;
  1137. getsym(static_name,true);
  1138. end;
  1139. p1:=genloadnode(pvarsym(srsym),srsymtable);
  1140. if pvarsym(srsym)^.is_valid=0 then
  1141. begin
  1142. p1^.is_first := true;
  1143. { set special between first loaded until checked in firstpass }
  1144. pvarsym(srsym)^.is_valid:=2;
  1145. end;
  1146. pd:=pvarsym(srsym)^.definition;
  1147. end;
  1148. typedconstsym : begin
  1149. p1:=gentypedconstloadnode(ptypedconstsym(srsym),srsymtable);
  1150. pd:=ptypedconstsym(srsym)^.definition;
  1151. end;
  1152. syssym : p1:=statement_syssym(psyssym(srsym)^.number,pd);
  1153. typesym : begin
  1154. pd:=ptypesym(srsym)^.definition;
  1155. { if we read a type declaration }
  1156. { we have to return the type and }
  1157. { nothing else }
  1158. if block_type=bt_type then
  1159. begin
  1160. p1:=genzeronode(typen);
  1161. p1^.resulttype:=pd;
  1162. pd:=voiddef;
  1163. end
  1164. else
  1165. begin
  1166. if token=LKLAMMER then
  1167. begin
  1168. consume(LKLAMMER);
  1169. p1:=comp_expr(true);
  1170. consume(RKLAMMER);
  1171. p1:=gentypeconvnode(p1,pd);
  1172. p1^.explizit:=true;
  1173. end
  1174. else
  1175. if (token=POINT) and
  1176. (pd^.deftype=objectdef) and
  1177. ((pobjectdef(pd)^.options and oois_class)=0) then
  1178. begin
  1179. consume(POINT);
  1180. if assigned(procinfo._class) then
  1181. begin
  1182. if procinfo._class^.isrelated(pobjectdef(pd)) then
  1183. begin
  1184. p1:=genzeronode(typen);
  1185. p1^.resulttype:=pd;
  1186. srsymtable:=pobjectdef(pd)^.publicsyms;
  1187. sym:=pvarsym(srsymtable^.search(pattern));
  1188. { search also in inherited methods }
  1189. while sym=nil do
  1190. begin
  1191. pd:=pobjectdef(pd)^.childof;
  1192. srsymtable:=pobjectdef(pd)^.publicsyms;
  1193. sym:=pvarsym(srsymtable^.search(pattern));
  1194. end;
  1195. consume(ID);
  1196. do_member_read(false,sym,p1,pd,again);
  1197. end
  1198. else
  1199. begin
  1200. Message(parser_e_no_super_class);
  1201. pd:=generrordef;
  1202. again:=false;
  1203. end;
  1204. end
  1205. else
  1206. begin
  1207. { allows @TObject.Load }
  1208. { also allows static methods and variables }
  1209. p1:=genzeronode(typen);
  1210. p1^.resulttype:=pd;
  1211. { srsymtable:=pobjectdef(pd)^.publicsyms;
  1212. sym:=pvarsym(srsymtable^.search(pattern)); }
  1213. { TP allows also @TMenu.Load if Load is only }
  1214. { defined in an anchestor class }
  1215. sym:=pvarsym(search_class_member(pobjectdef(pd),pattern));
  1216. if not(getaddr) and ((sym^.properties and sp_static)=0) then
  1217. Message(sym_e_only_static_in_static)
  1218. else
  1219. begin
  1220. consume(ID);
  1221. do_member_read(getaddr,sym,p1,pd,again);
  1222. end;
  1223. end;
  1224. end
  1225. else
  1226. begin
  1227. { class reference ? }
  1228. if (pd^.deftype=objectdef)
  1229. and ((pobjectdef(pd)^.options and oois_class)<>0) then
  1230. begin
  1231. p1:=genzeronode(typen);
  1232. p1^.resulttype:=pd;
  1233. pd:=new(pclassrefdef,init(pd));
  1234. p1:=gensinglenode(loadvmtn,p1);
  1235. p1^.resulttype:=pd;
  1236. end
  1237. else
  1238. begin
  1239. { generate a type node }
  1240. { (for typeof etc) }
  1241. p1:=genzeronode(typen);
  1242. p1^.resulttype:=pd;
  1243. pd:=voiddef;
  1244. end;
  1245. end;
  1246. end;
  1247. end;
  1248. enumsym : begin
  1249. p1:=genenumnode(penumsym(srsym));
  1250. pd:=p1^.resulttype;
  1251. end;
  1252. constsym : begin
  1253. case pconstsym(srsym)^.consttype of
  1254. constint : p1:=genordinalconstnode(pconstsym(srsym)^.value,s32bitdef);
  1255. conststring : p1:=genstringconstnode(pstring(pconstsym(srsym)^.value)^);
  1256. constchar : p1:=genordinalconstnode(pconstsym(srsym)^.value,cchardef);
  1257. constreal : p1:=genrealconstnode(pbestreal(pconstsym(srsym)^.value)^);
  1258. constbool : p1:=genordinalconstnode(pconstsym(srsym)^.value,booldef);
  1259. constseta : p1:=gensetconstruktnode(pconstset(pconstsym(srsym)^.value),
  1260. psetdef(pconstsym(srsym)^.definition));
  1261. constord : p1:=genordinalconstnode(pconstsym(srsym)^.value,
  1262. pconstsym(srsym)^.definition);
  1263. end;
  1264. pd:=p1^.resulttype;
  1265. end;
  1266. procsym : begin
  1267. { are we in a class method ? }
  1268. possible_error:=(srsymtable^.symtabletype=objectsymtable) and
  1269. assigned(aktprocsym) and
  1270. ((aktprocsym^.definition^.options and poclassmethod)<>0);
  1271. p1:=gencallnode(pprocsym(srsym),srsymtable);
  1272. p1^.unit_specific:=unit_specific;
  1273. do_proc_call(getaddr or
  1274. (getprocvar and
  1275. proc_to_procvar_equal(getprocvardef,pprocsym(srsym)^.definition)),
  1276. again,p1,pd);
  1277. if possible_error and
  1278. ((p1^.procdefinition^.options and poclassmethod)=0) then
  1279. Message(parser_e_only_class_methods);
  1280. end;
  1281. propertysym : begin
  1282. { access to property in a method }
  1283. { are we in a class method ? }
  1284. if (srsymtable^.symtabletype=objectsymtable) and
  1285. assigned(aktprocsym) and
  1286. ((aktprocsym^.definition^.options and poclassmethod)<>0) then
  1287. Message(parser_e_only_class_methods);
  1288. { no method pointer }
  1289. p1:=nil;
  1290. handle_propertysym(srsym,p1,pd);
  1291. end;
  1292. errorsym : begin
  1293. p1:=genzeronode(errorn);
  1294. pd:=generrordef;
  1295. if token=LKLAMMER then
  1296. begin
  1297. consume(LKLAMMER);
  1298. parse_paras(false,false);
  1299. consume(RKLAMMER);
  1300. end;
  1301. end;
  1302. else
  1303. begin
  1304. p1:=genzeronode(errorn);
  1305. pd:=generrordef;
  1306. Message(cg_e_illegal_expression);
  1307. end;
  1308. end; { end case }
  1309. end;
  1310. end;
  1311. end;
  1312. { handle post fix operators }
  1313. postfixoperators;
  1314. end;
  1315. _NEW : begin
  1316. consume(_NEW);
  1317. consume(LKLAMMER);
  1318. p1:=factor(false);
  1319. if p1^.treetype<>typen then
  1320. Message(sym_e_type_id_expected);
  1321. pd:=p1^.resulttype;
  1322. pd2:=pd;
  1323. if (pd^.deftype<>pointerdef) or
  1324. (ppointerdef(pd)^.definition^.deftype<>objectdef) then
  1325. begin
  1326. Message(parser_e_pointer_to_class_expected);
  1327. { if an error occurs, read til the end of
  1328. the new statement }
  1329. p1:=genzeronode(errorn);
  1330. l:=1;
  1331. while true do
  1332. begin
  1333. case token of
  1334. LKLAMMER : inc(l);
  1335. RKLAMMER : dec(l);
  1336. end;
  1337. consume(token);
  1338. if l=0 then
  1339. break;
  1340. end;
  1341. end
  1342. else
  1343. begin
  1344. disposetree(p1);
  1345. p1:=genzeronode(hnewn);
  1346. p1^.resulttype:=ppointerdef(pd)^.definition;
  1347. consume(COMMA);
  1348. afterassignment:=false;
  1349. { determines the current object defintion }
  1350. classh:=pobjectdef(ppointerdef(pd)^.definition);
  1351. { check for an abstract class }
  1352. if (classh^.options and oois_abstract)<>0 then
  1353. Message(sym_e_no_instance_of_abstract_object);
  1354. { search the constructor also in the symbol tables of
  1355. the parents }
  1356. { no constructor found }
  1357. sym:=nil;
  1358. while assigned(classh) do
  1359. begin
  1360. sym:=pvarsym(classh^.publicsyms^.search(pattern));
  1361. srsymtable:=classh^.publicsyms;
  1362. if assigned(sym) then
  1363. break;
  1364. classh:=classh^.childof;
  1365. end;
  1366. consume(ID);
  1367. do_member_read(false,sym,p1,pd,again);
  1368. if (p1^.treetype<>calln) or
  1369. (assigned(p1^.procdefinition) and
  1370. ((p1^.procdefinition^.options and poconstructor)=0)) then
  1371. Message(parser_e_expr_have_to_be_constructor_call);
  1372. p1:=gensinglenode(newn,p1);
  1373. { set the resulttype }
  1374. p1^.resulttype:=pd2;
  1375. consume(RKLAMMER);
  1376. end;
  1377. end;
  1378. _SELF : begin
  1379. again:=true;
  1380. consume(_SELF);
  1381. if not assigned(procinfo._class) then
  1382. begin
  1383. p1:=genzeronode(errorn);
  1384. pd:=generrordef;
  1385. again:=false;
  1386. Message(parser_e_self_not_in_method);
  1387. end
  1388. else
  1389. begin
  1390. if (aktprocsym^.definition^.options and poclassmethod)<>0 then
  1391. begin
  1392. { self in class methods is a class reference type }
  1393. pd:=new(pclassrefdef,init(procinfo._class));
  1394. p1:=genselfnode(pd);
  1395. p1^.resulttype:=pd;
  1396. end
  1397. else
  1398. begin
  1399. p1:=genselfnode(procinfo._class);
  1400. p1^.resulttype:=procinfo._class;
  1401. end;
  1402. pd:=p1^.resulttype;
  1403. postfixoperators;
  1404. end;
  1405. end;
  1406. _INHERITED : begin
  1407. again:=true;
  1408. consume(_INHERITED);
  1409. if assigned(procinfo._class) then
  1410. begin
  1411. classh:=procinfo._class^.childof;
  1412. while assigned(classh) do
  1413. begin
  1414. srsymtable:=pobjectdef(classh)^.publicsyms;
  1415. sym:=pvarsym(srsymtable^.search(pattern));
  1416. if assigned(sym) then
  1417. begin
  1418. p1:=genzeronode(typen);
  1419. p1^.resulttype:=classh;
  1420. pd:=p1^.resulttype;
  1421. consume(ID);
  1422. do_member_read(false,sym,p1,pd,again);
  1423. break;
  1424. end;
  1425. classh:=classh^.childof;
  1426. end;
  1427. if classh=nil then
  1428. begin
  1429. Message1(sym_e_id_no_member,pattern);
  1430. again:=false;
  1431. pd:=generrordef;
  1432. p1:=genzeronode(errorn);
  1433. end;
  1434. end
  1435. else
  1436. Message(parser_e_generic_methods_only_in_methods);
  1437. postfixoperators;
  1438. end;
  1439. INTCONST : begin
  1440. valint(pattern,l,code);
  1441. if code<>0 then
  1442. begin
  1443. val(pattern,d,code);
  1444. if code<>0 then
  1445. begin
  1446. Message(cg_e_invalid_integer);
  1447. consume(INTCONST);
  1448. l:=1;
  1449. p1:=genordinalconstnode(l,s32bitdef);
  1450. end
  1451. else
  1452. begin
  1453. consume(INTCONST);
  1454. p1:=genrealconstnode(d);
  1455. end;
  1456. end
  1457. else
  1458. begin
  1459. consume(INTCONST);
  1460. p1:=genordinalconstnode(l,s32bitdef);
  1461. end;
  1462. end;
  1463. REALNUMBER : begin
  1464. val(pattern,d,code);
  1465. if code<>0 then
  1466. begin
  1467. Message(parser_e_error_in_real);
  1468. d:=1.0;
  1469. end;
  1470. consume(REALNUMBER);
  1471. p1:=genrealconstnode(d);
  1472. end;
  1473. _STRING : begin
  1474. { STRING can be also a type cast }
  1475. pd:=stringtype;
  1476. consume(LKLAMMER);
  1477. p1:=comp_expr(true);
  1478. consume(RKLAMMER);
  1479. p1:=gentypeconvnode(p1,pd);
  1480. p1^.explizit:=true;
  1481. { handle postfix operators here e.g. string(a)[10] }
  1482. again:=true;
  1483. postfixoperators;
  1484. end;
  1485. _FILE : begin
  1486. { FILE can be also a type cast }
  1487. pd:=cfiledef;
  1488. consume(_FILE);
  1489. if token=LKLAMMER then
  1490. begin
  1491. consume(LKLAMMER);
  1492. p1:=comp_expr(true);
  1493. consume(RKLAMMER);
  1494. p1:=gentypeconvnode(p1,pd);
  1495. end
  1496. else
  1497. begin
  1498. p1:=genzeronode(typen);
  1499. p1^.resulttype:=pd;
  1500. end;
  1501. p1^.explizit:=true;
  1502. { handle postfix operators here e.g. string(a)[10] }
  1503. again:=true;
  1504. postfixoperators;
  1505. end;
  1506. CSTRING : begin
  1507. p1:=genstringconstnode(pattern);
  1508. consume(CSTRING);
  1509. end;
  1510. CCHAR : begin
  1511. p1:=genordinalconstnode(ord(pattern[1]),cchardef);
  1512. consume(CCHAR);
  1513. end;
  1514. KLAMMERAFFE : begin
  1515. consume(KLAMMERAFFE);
  1516. p1:=factor(true);
  1517. p1:=gensinglenode(addrn,p1);
  1518. end;
  1519. LKLAMMER : begin
  1520. consume(LKLAMMER);
  1521. p1:=comp_expr(true);
  1522. consume(RKLAMMER);
  1523. { it's not a good solution }
  1524. { but (a+b)^ makes some problems }
  1525. if token in [CARET,POINT,LECKKLAMMER] then
  1526. begin
  1527. { we need the resulttype }
  1528. { of the expression in pd }
  1529. do_firstpass(p1);
  1530. pd:=p1^.resulttype;
  1531. again:=true;
  1532. postfixoperators;
  1533. end;
  1534. end;
  1535. LECKKLAMMER : begin
  1536. consume(LECKKLAMMER);
  1537. p1:=factor_read_set;
  1538. consume(RECKKLAMMER);
  1539. end;
  1540. PLUS : begin
  1541. consume(PLUS);
  1542. p1:=factor(false);
  1543. end;
  1544. MINUS : begin
  1545. consume(MINUS);
  1546. p1:=factor(false);
  1547. p1:=gensinglenode(umminusn,p1);
  1548. end;
  1549. _NOT : begin
  1550. consume(_NOT);
  1551. p1:=factor(false);
  1552. p1:=gensinglenode(notn,p1);
  1553. end;
  1554. _TRUE : begin
  1555. consume(_TRUE);
  1556. p1:=genordinalconstnode(1,booldef);
  1557. end;
  1558. _FALSE : begin
  1559. consume(_FALSE);
  1560. p1:=genordinalconstnode(0,booldef);
  1561. end;
  1562. _NIL : begin
  1563. consume(_NIL);
  1564. p1:=genzeronode(niln);
  1565. end;
  1566. else
  1567. begin
  1568. p1:=genzeronode(errorn);
  1569. consume(token);
  1570. Message(cg_e_illegal_expression);
  1571. end;
  1572. end;
  1573. factor:=p1;
  1574. check_tokenpos;
  1575. end;
  1576. {****************************************************************************
  1577. Sub_Expr
  1578. ****************************************************************************}
  1579. type
  1580. Toperator_precedence=(opcompare,opaddition,opmultiply);
  1581. const
  1582. tok2node:array[PLUS.._XOR] of Ttreetyp=
  1583. (addn,subn,muln,slashn,equaln,gtn,ltn,gten,lten,
  1584. isn,asn,inn,
  1585. symdifn,starstarn,nothingn,caretn,unequaln,nothingn,
  1586. nothingn,nothingn,nothingn,nothingn,nothingn,
  1587. nothingn,nothingn,nothingn,nothingn,nothingn,
  1588. nothingn,nothingn,nothingn,nothingn,nothingn,
  1589. nothingn,andn,nothingn,nothingn,nothingn,
  1590. nothingn,nothingn,nothingn,nothingn,nothingn,
  1591. nothingn,nothingn,divn,nothingn,nothingn,
  1592. nothingn,nothingn,nothingn,nothingn,nothingn,
  1593. nothingn,nothingn,nothingn,nothingn,nothingn,
  1594. nothingn,nothingn,nothingn,nothingn,nothingn,
  1595. modn,nothingn,nothingn,nothingn,nothingn,
  1596. nothingn,nothingn,orn,
  1597. nothingn,nothingn,nothingn,nothingn,nothingn,
  1598. nothingn,nothingn,shln,shrn,
  1599. nothingn,nothingn,nothingn,nothingn,nothingn,
  1600. nothingn,nothingn,nothingn,nothingn,nothingn,
  1601. nothingn,xorn);
  1602. operator_levels:array[Toperator_precedence] of set of Ttoken=
  1603. ([LT,LTE,GT,GTE,EQUAL,UNEQUAL,_IN,_IS],
  1604. [PLUS,MINUS,_OR,_XOR],
  1605. [CARET,SYMDIF,STARSTAR,STAR,SLASH,_DIV,_MOD,_AND,_SHL,_SHR,_AS]);
  1606. function sub_expr(pred_level:Toperator_precedence;accept_equal : boolean):Ptree;
  1607. {Reads a subexpression while the operators are of the current precedence
  1608. level, or any higher level. Replaces the old term, simpl_expr and
  1609. simpl2_expr.}
  1610. var p1,p2:Ptree;
  1611. oldt:Ttoken;
  1612. filepos : tfileposinfo;
  1613. begin
  1614. { if pred_level=high(Toperator_precedence) then }
  1615. if pred_level=opmultiply then
  1616. { this IS wrong !!! PM
  1617. p1:=factor(getprocvar)}
  1618. p1:=factor(false)
  1619. else
  1620. p1:=sub_expr(succ(pred_level),true);
  1621. repeat
  1622. { aweful hack to support const a : 1..2=1; }
  1623. { disadvantage of tables :) FK }
  1624. if (token in operator_levels[pred_level]) and
  1625. ((token<>EQUAL) or accept_equal) then
  1626. begin
  1627. oldt:=token;
  1628. filepos:=tokenpos;
  1629. consume(token);
  1630. { if pred_level=high(Toperator_precedence) then }
  1631. if pred_level=opmultiply then
  1632. p2:=factor(false)
  1633. else
  1634. p2:=sub_expr(succ(pred_level),true);
  1635. p1:=gennode(tok2node[oldt],p1,p2);
  1636. set_tree_filepos(p1,filepos);
  1637. end
  1638. else
  1639. break;
  1640. until false;
  1641. sub_expr:=p1;
  1642. end;
  1643. function comp_expr(accept_equal : boolean):Ptree;
  1644. var
  1645. oldafterassignment : boolean;
  1646. begin
  1647. oldafterassignment:=afterassignment;
  1648. afterassignment:=true;
  1649. comp_expr:=sub_expr(opcompare,accept_equal);
  1650. afterassignment:=oldafterassignment;
  1651. end;
  1652. function expr : ptree;
  1653. var
  1654. p1,p2 : ptree;
  1655. oldafterassignment : boolean;
  1656. oldp1 : ptree;
  1657. filepos : tfileposinfo;
  1658. begin
  1659. oldafterassignment:=afterassignment;
  1660. p1:=sub_expr(opcompare,true);
  1661. if token in [ASSIGNMENT,_PLUSASN,_MINUSASN,_STARASN,_SLASHASN] then
  1662. afterassignment:=true;
  1663. filepos:=tokenpos;
  1664. oldp1:=p1;
  1665. case token of
  1666. POINTPOINT : begin
  1667. consume(POINTPOINT);
  1668. p2:=sub_expr(opcompare,true);
  1669. p1:=gennode(rangen,p1,p2);
  1670. end;
  1671. ASSIGNMENT : begin
  1672. consume(ASSIGNMENT);
  1673. { avoid a firstpass of a procedure if
  1674. it must be assigned to a procvar }
  1675. { should be recursive for a:=b:=c !!! }
  1676. if (p1^.resulttype<>nil) and (p1^.resulttype^.deftype=procvardef) then
  1677. begin
  1678. getprocvar:=true;
  1679. getprocvardef:=pprocvardef(p1^.resulttype);
  1680. end;
  1681. p2:=sub_expr(opcompare,true);
  1682. if getprocvar and (p2^.treetype=calln) and
  1683. (proc_to_procvar_equal(getprocvardef,pprocsym(p2^.symtableentry)^.definition)) then
  1684. begin
  1685. p2^.treetype:=loadn;
  1686. p2^.resulttype:=pprocsym(p2^.symtableprocentry)^.definition;
  1687. p2^.symtableentry:=p2^.symtableprocentry;
  1688. end;
  1689. getprocvar:=false;
  1690. p1:=gennode(assignn,p1,p2);
  1691. end;
  1692. { this is the code for C like assignements }
  1693. { from an improvement of Peter Schaefer }
  1694. _PLUSASN : begin
  1695. consume(_PLUSASN );
  1696. p2:=sub_expr(opcompare,true);
  1697. p1:=gennode(assignn,p1,gennode(addn,getcopy(p1),p2));
  1698. { was first
  1699. p1:=gennode(assignn,p1,gennode(addn,p1,p2));
  1700. but disposetree assumes that we have a real
  1701. *** tree *** }
  1702. end;
  1703. _MINUSASN : begin
  1704. consume(_MINUSASN );
  1705. p2:=sub_expr(opcompare,true);
  1706. p1:=gennode(assignn,p1,gennode(subn,getcopy(p1),p2));
  1707. end;
  1708. _STARASN : begin
  1709. consume(_STARASN );
  1710. p2:=sub_expr(opcompare,true);
  1711. p1:=gennode(assignn,p1,gennode(muln,getcopy(p1),p2));
  1712. end;
  1713. _SLASHASN : begin
  1714. consume(_SLASHASN );
  1715. p2:=sub_expr(opcompare,true);
  1716. p1:=gennode(assignn,p1,gennode(slashn,getcopy(p1),p2));
  1717. end;
  1718. end;
  1719. afterassignment:=oldafterassignment;
  1720. if p1<>oldp1 then
  1721. set_tree_filepos(p1,filepos);
  1722. expr:=p1;
  1723. end;
  1724. function get_intconst:longint;
  1725. {Reads an expression, tries to evalute it and check if it is an integer
  1726. constant. Then the constant is returned.}
  1727. var
  1728. p:Ptree;
  1729. begin
  1730. p:=comp_expr(true);
  1731. do_firstpass(p);
  1732. if (p^.treetype<>ordconstn) and
  1733. (p^.resulttype^.deftype=orddef) and
  1734. not(Porddef(p^.resulttype)^.typ in [uvoid,uchar,bool8bit,bool16bit,bool32bit]) then
  1735. Message(cg_e_illegal_expression)
  1736. else
  1737. get_intconst:=p^.value;
  1738. disposetree(p);
  1739. end;
  1740. function get_stringconst:string;
  1741. {Reads an expression, tries to evaluate it and checks if it is a string
  1742. constant. Then the constant is returned.}
  1743. var
  1744. p:Ptree;
  1745. begin
  1746. get_stringconst:='';
  1747. p:=comp_expr(true);
  1748. do_firstpass(p);
  1749. if p^.treetype<>stringconstn then
  1750. begin
  1751. if (p^.treetype=ordconstn) and
  1752. (p^.resulttype^.deftype=orddef) and
  1753. (Porddef(p^.resulttype)^.typ=uchar) then
  1754. get_stringconst:=char(p^.value)
  1755. else
  1756. Message(cg_e_illegal_expression);
  1757. end
  1758. else
  1759. get_stringconst:=p^.values^;
  1760. disposetree(p);
  1761. end;
  1762. end.
  1763. {
  1764. $Log$
  1765. Revision 1.39 1998-08-18 16:48:48 pierre
  1766. * bug for -So proc assignment to p^rocvar fixed
  1767. Revision 1.38 1998/08/18 14:17:09 pierre
  1768. * bug about assigning the return value of a function to
  1769. a procvar fixed : warning
  1770. assigning a proc to a procvar need @ in FPC mode !!
  1771. * missing file/line info restored
  1772. Revision 1.37 1998/08/18 09:24:43 pierre
  1773. * small warning position bug fixed
  1774. * support_mmx switches splitting was missing
  1775. * rhide error and warning output corrected
  1776. Revision 1.36 1998/08/15 16:50:29 peter
  1777. * fixed proc()=expr which was not allowed anymore by my previous fix
  1778. Revision 1.35 1998/08/14 18:18:46 peter
  1779. + dynamic set contruction
  1780. * smallsets are now working (always longint size)
  1781. Revision 1.34 1998/08/13 11:00:12 peter
  1782. * fixed procedure<>procedure construct
  1783. Revision 1.33 1998/08/11 15:31:39 peter
  1784. * write extended to ppu file
  1785. * new version 0.99.7
  1786. Revision 1.32 1998/08/11 14:05:32 peter
  1787. * fixed sizeof(array of char)
  1788. Revision 1.31 1998/08/10 14:50:11 peter
  1789. + localswitches, moduleswitches, globalswitches splitting
  1790. Revision 1.30 1998/07/28 21:52:54 florian
  1791. + implementation of raise and try..finally
  1792. + some misc. exception stuff
  1793. Revision 1.29 1998/07/27 21:57:13 florian
  1794. * fix to allow tv like stream registration:
  1795. @tmenu.load doesn't work if load had parameters or if load was only
  1796. declared in an anchestor class of tmenu
  1797. Revision 1.28 1998/07/14 21:46:51 peter
  1798. * updated messages file
  1799. Revision 1.27 1998/06/25 14:04:23 peter
  1800. + internal inc/dec
  1801. Revision 1.26 1998/06/09 16:01:46 pierre
  1802. + added procedure directive parsing for procvars
  1803. (accepted are popstack cdecl and pascal)
  1804. + added C vars with the following syntax
  1805. var C calias 'true_c_name';(can be followed by external)
  1806. reason is that you must add the Cprefix
  1807. which is target dependent
  1808. Revision 1.25 1998/06/05 14:37:33 pierre
  1809. * fixes for inline for operators
  1810. * inline procedure more correctly restricted
  1811. Revision 1.24 1998/06/04 23:51:52 peter
  1812. * m68k compiles
  1813. + .def file creation moved to gendef.pas so it could also be used
  1814. for win32
  1815. Revision 1.23 1998/06/04 09:55:40 pierre
  1816. * demangled name of procsym reworked to become independant of the mangling scheme
  1817. Revision 1.22 1998/06/02 17:03:03 pierre
  1818. * with node corrected for objects
  1819. * small bugs for SUPPORT_MMX fixed
  1820. Revision 1.21 1998/05/27 19:45:05 peter
  1821. * symtable.pas splitted into includefiles
  1822. * symtable adapted for $ifdef NEWPPU
  1823. Revision 1.20 1998/05/26 07:53:59 pierre
  1824. * bug fix for empty sets (nil pd was dereferenced )
  1825. Revision 1.19 1998/05/25 17:11:43 pierre
  1826. * firstpasscount bug fixed
  1827. now all is already set correctly the first time
  1828. under EXTDEBUG try -gp to skip all other firstpasses
  1829. it works !!
  1830. * small bug fixes
  1831. - for smallsets with -dTESTSMALLSET
  1832. - some warnings removed (by correcting code !)
  1833. Revision 1.18 1998/05/23 01:21:20 peter
  1834. + aktasmmode, aktoptprocessor, aktoutputformat
  1835. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  1836. + $LIBNAME to set the library name where the unit will be put in
  1837. * splitted cgi386 a bit (codeseg to large for bp7)
  1838. * nasm, tasm works again. nasm moved to ag386nsm.pas
  1839. Revision 1.17 1998/05/22 12:37:03 carl
  1840. * crash bugfix (patched msanually to main branch)
  1841. Revision 1.16 1998/05/21 19:33:32 peter
  1842. + better procedure directive handling and only one table
  1843. Revision 1.15 1998/05/20 09:42:35 pierre
  1844. + UseTokenInfo now default
  1845. * unit in interface uses and implementation uses gives error now
  1846. * only one error for unknown symbol (uses lastsymknown boolean)
  1847. the problem came from the label code !
  1848. + first inlined procedures and function work
  1849. (warning there might be allowed cases were the result is still wrong !!)
  1850. * UseBrower updated gives a global list of all position of all used symbols
  1851. with switch -gb
  1852. Revision 1.14 1998/05/11 13:07:56 peter
  1853. + $ifdef NEWPPU for the new ppuformat
  1854. + $define GDB not longer required
  1855. * removed all warnings and stripped some log comments
  1856. * no findfirst/findnext anymore to remove smartlink *.o files
  1857. Revision 1.13 1998/05/06 08:38:45 pierre
  1858. * better position info with UseTokenInfo
  1859. UseTokenInfo greatly simplified
  1860. + added check for changed tree after first time firstpass
  1861. (if we could remove all the cases were it happen
  1862. we could skip all firstpass if firstpasscount > 1)
  1863. Only with ExtDebug
  1864. Revision 1.12 1998/05/05 12:05:42 florian
  1865. * problems with properties fixed
  1866. * crash fixed: i:=l when i and l are undefined, was a problem with
  1867. implementation of private/protected
  1868. Revision 1.11 1998/05/04 11:22:26 florian
  1869. * problem with DOM solved: it crashes when accessing a property in a method
  1870. Revision 1.10 1998/05/01 16:38:45 florian
  1871. * handling of private and protected fixed
  1872. + change_keywords_to_tp implemented to remove
  1873. keywords which aren't supported by tp
  1874. * break and continue are now symbols of the system unit
  1875. + widestring, longstring and ansistring type released
  1876. Revision 1.9 1998/04/29 10:33:58 pierre
  1877. + added some code for ansistring (not complete nor working yet)
  1878. * corrected operator overloading
  1879. * corrected nasm output
  1880. + started inline procedures
  1881. + added starstarn : use ** for exponentiation (^ gave problems)
  1882. + started UseTokenInfo cond to get accurate positions
  1883. Revision 1.8 1998/04/14 23:27:03 florian
  1884. + exclude/include with constant second parameter added
  1885. Revision 1.7 1998/04/09 23:02:15 florian
  1886. * small problems solved to get remake3 work
  1887. Revision 1.6 1998/04/09 22:16:35 florian
  1888. * problem with previous REGALLOC solved
  1889. * improved property support
  1890. Revision 1.5 1998/04/08 10:26:09 florian
  1891. * correct error handling of virtual constructors
  1892. * problem with new type declaration handling fixed
  1893. Revision 1.4 1998/04/07 22:45:05 florian
  1894. * bug0092, bug0115 and bug0121 fixed
  1895. + packed object/class/array
  1896. Revision 1.3 1998/04/07 13:19:46 pierre
  1897. * bugfixes for reset_gdb_info
  1898. in MEM parsing for go32v2
  1899. better external symbol creation
  1900. support for rhgdb.exe (lowercase file names)
  1901. }