pexpr.pas 97 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695
  1. {
  2. $Id$
  3. Copyright (c) 1998-2001 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. {$i defines.inc}
  20. interface
  21. uses
  22. symtype,
  23. node,
  24. cpuinfo;
  25. { reads a whole expression }
  26. function expr : tnode;
  27. { reads an expression without assignements and .. }
  28. function comp_expr(accept_equal : boolean):tnode;
  29. { reads a single factor }
  30. function factor(getaddr : boolean) : tnode;
  31. procedure string_dec(var t: ttype);
  32. { the ID token has to be consumed before calling this function }
  33. procedure do_member_read(getaddr : boolean;sym : tsym;var p1 : tnode;var again : boolean);
  34. {$ifdef int64funcresok}
  35. function get_intconst:TConstExprInt;
  36. {$else int64funcresok}
  37. function get_intconst:longint;
  38. {$endif int64funcresok}
  39. function get_stringconst:string;
  40. implementation
  41. uses
  42. {$ifdef delphi}
  43. SysUtils,
  44. {$endif}
  45. { common }
  46. cutils,
  47. { global }
  48. globtype,globals,tokens,verbose,
  49. systems,widestr,
  50. { symtable }
  51. symconst,symbase,symdef,symsym,symtable,types,
  52. { pass 1 }
  53. pass_1,htypechk,
  54. nmat,nadd,ncal,nmem,nset,ncnv,ninl,ncon,nld,nflw,nbas,
  55. { parser }
  56. scanner,
  57. pbase,
  58. { codegen }
  59. cgbase
  60. ;
  61. { sub_expr(opmultiply) is need to get -1 ** 4 to be
  62. read as - (1**4) and not (-1)**4 PM }
  63. type
  64. Toperator_precedence=(opcompare,opaddition,opmultiply,oppower);
  65. const
  66. highest_precedence = oppower;
  67. function sub_expr(pred_level:Toperator_precedence;accept_equal : boolean):tnode;forward;
  68. const
  69. got_addrn : boolean = false;
  70. auto_inherited : boolean = false;
  71. procedure string_dec(var t: ttype);
  72. { reads a string type with optional length }
  73. { and returns a pointer to the string }
  74. { definition }
  75. var
  76. p : tnode;
  77. begin
  78. t:=cshortstringtype;
  79. consume(_STRING);
  80. if token=_LECKKLAMMER then
  81. begin
  82. consume(_LECKKLAMMER);
  83. p:=comp_expr(true);
  84. if not is_constintnode(p) then
  85. begin
  86. Message(cg_e_illegal_expression);
  87. { error recovery }
  88. consume(_RECKKLAMMER);
  89. end
  90. else
  91. begin
  92. if (tordconstnode(p).value<=0) then
  93. begin
  94. Message(parser_e_invalid_string_size);
  95. tordconstnode(p).value:=255;
  96. end;
  97. consume(_RECKKLAMMER);
  98. if tordconstnode(p).value>255 then
  99. t.setdef(tstringdef.createlong(tordconstnode(p).value))
  100. else
  101. if tordconstnode(p).value<>255 then
  102. t.setdef(tstringdef.createshort(tordconstnode(p).value));
  103. end;
  104. p.free;
  105. end
  106. else
  107. begin
  108. if cs_ansistrings in aktlocalswitches then
  109. t:=cansistringtype
  110. else
  111. t:=cshortstringtype;
  112. end;
  113. end;
  114. function parse_paras(__colon,in_prop_paras : boolean) : tnode;
  115. var
  116. p1,p2 : tnode;
  117. end_of_paras : ttoken;
  118. prev_in_args : boolean;
  119. old_allow_array_constructor : boolean;
  120. begin
  121. if in_prop_paras then
  122. end_of_paras:=_RECKKLAMMER
  123. else
  124. end_of_paras:=_RKLAMMER;
  125. if token=end_of_paras then
  126. begin
  127. parse_paras:=nil;
  128. exit;
  129. end;
  130. { save old values }
  131. prev_in_args:=in_args;
  132. old_allow_array_constructor:=allow_array_constructor;
  133. { set para parsing values }
  134. in_args:=true;
  135. inc(parsing_para_level);
  136. allow_array_constructor:=true;
  137. p2:=nil;
  138. while true do
  139. begin
  140. p1:=comp_expr(true);
  141. p2:=ccallparanode.create(p1,p2);
  142. { it's for the str(l:5,s); }
  143. if __colon and (token=_COLON) then
  144. begin
  145. consume(_COLON);
  146. p1:=comp_expr(true);
  147. p2:=ccallparanode.create(p1,p2);
  148. include(tcallparanode(p2).callparaflags,cpf_is_colon_para);
  149. if token=_COLON then
  150. begin
  151. consume(_COLON);
  152. p1:=comp_expr(true);
  153. p2:=ccallparanode.create(p1,p2);
  154. include(tcallparanode(p2).callparaflags,cpf_is_colon_para);
  155. end
  156. end;
  157. if token=_COMMA then
  158. consume(_COMMA)
  159. else
  160. break;
  161. end;
  162. allow_array_constructor:=old_allow_array_constructor;
  163. dec(parsing_para_level);
  164. in_args:=prev_in_args;
  165. parse_paras:=p2;
  166. end;
  167. procedure check_tp_procvar(var p : tnode);
  168. var
  169. p1 : tnode;
  170. begin
  171. if (m_tp_procvar in aktmodeswitches) and
  172. (not got_addrn) and
  173. (not in_args) and
  174. (p.nodetype=loadn) then
  175. begin
  176. { support if procvar then for tp7 and many other expression like this }
  177. do_resulttypepass(p);
  178. set_varstate(p,false);
  179. { reset varstateset to maybe set used state later web bug769 PM }
  180. unset_varstate(p);
  181. if (getprocvardef=nil) and (p.resulttype.def.deftype=procvardef) then
  182. begin
  183. p1:=ccallnode.create(nil,nil,nil,nil);
  184. tcallnode(p1).set_procvar(p);
  185. resulttypepass(p1);
  186. p:=p1;
  187. end;
  188. end;
  189. end;
  190. function new_dispose_statement(is_new:boolean) : tnode;
  191. var
  192. p,p2 : tnode;
  193. again : boolean; { dummy for do_proc_call }
  194. destructorname : stringid;
  195. sym : tsym;
  196. classh : tobjectdef;
  197. destructorpos,
  198. storepos : tfileposinfo;
  199. begin
  200. consume(_LKLAMMER);
  201. p:=comp_expr(true);
  202. { calc return type }
  203. { cleartempgen; }
  204. set_varstate(p,(not is_new));
  205. { constructor,destructor specified }
  206. if try_to_consume(_COMMA) then
  207. begin
  208. { extended syntax of new and dispose }
  209. { function styled new is handled in factor }
  210. { destructors have no parameters }
  211. destructorname:=pattern;
  212. destructorpos:=akttokenpos;
  213. consume(_ID);
  214. if (p.resulttype.def.deftype<>pointerdef) then
  215. begin
  216. Message1(type_e_pointer_type_expected,p.resulttype.def.typename);
  217. p.free;
  218. p:=factor(false);
  219. p.free;
  220. consume(_RKLAMMER);
  221. new_dispose_statement:=cerrornode.create;
  222. exit;
  223. end;
  224. { first parameter must be an object or class }
  225. if tpointerdef(p.resulttype.def).pointertype.def.deftype<>objectdef then
  226. begin
  227. Message(parser_e_pointer_to_class_expected);
  228. p.free;
  229. new_dispose_statement:=factor(false);
  230. consume_all_until(_RKLAMMER);
  231. consume(_RKLAMMER);
  232. exit;
  233. end;
  234. { check, if the first parameter is a pointer to a _class_ }
  235. classh:=tobjectdef(tpointerdef(p.resulttype.def).pointertype.def);
  236. if is_class(classh) then
  237. begin
  238. Message(parser_e_no_new_or_dispose_for_classes);
  239. new_dispose_statement:=factor(false);
  240. consume_all_until(_RKLAMMER);
  241. consume(_RKLAMMER);
  242. exit;
  243. end;
  244. { search cons-/destructor, also in parent classes }
  245. storepos:=akttokenpos;
  246. akttokenpos:=destructorpos;
  247. sym:=search_class_member(classh,destructorname);
  248. akttokenpos:=storepos;
  249. { the second parameter of new/dispose must be a call }
  250. { to a cons-/destructor }
  251. if (not assigned(sym)) or (sym.typ<>procsym) then
  252. begin
  253. if is_new then
  254. Message(parser_e_expr_have_to_be_constructor_call)
  255. else
  256. Message(parser_e_expr_have_to_be_destructor_call);
  257. p.free;
  258. new_dispose_statement:=cerrornode.create;
  259. end
  260. else
  261. begin
  262. if is_new then
  263. p2:=chnewnode.create
  264. else
  265. p2:=chdisposenode.create(p);
  266. do_resulttypepass(p2);
  267. p2.resulttype:=tpointerdef(p.resulttype.def).pointertype;
  268. if is_new then
  269. do_member_read(false,sym,p2,again)
  270. else
  271. begin
  272. if not(m_fpc in aktmodeswitches) then
  273. do_member_read(false,sym,p2,again)
  274. else
  275. begin
  276. p2:=ccallnode.create(nil,tprocsym(sym),sym.owner,p2);
  277. { support dispose(p,done()); }
  278. if try_to_consume(_LKLAMMER) then
  279. begin
  280. if not try_to_consume(_RKLAMMER) then
  281. begin
  282. Message(parser_e_no_paras_for_destructor);
  283. consume_all_until(_RKLAMMER);
  284. consume(_RKLAMMER);
  285. end;
  286. end;
  287. end;
  288. end;
  289. { we need the real called method }
  290. { cleartempgen;}
  291. do_resulttypepass(p2);
  292. if not codegenerror then
  293. begin
  294. if is_new then
  295. begin
  296. if (tcallnode(p2).procdefinition.proctypeoption<>potype_constructor) then
  297. Message(parser_e_expr_have_to_be_constructor_call);
  298. p2:=cnewnode.create(p2);
  299. do_resulttypepass(p2);
  300. p2.resulttype:=p.resulttype;
  301. p2:=cassignmentnode.create(p,p2);
  302. end
  303. else
  304. begin
  305. if (tcallnode(p2).procdefinition.proctypeoption<>potype_destructor) then
  306. Message(parser_e_expr_have_to_be_destructor_call);
  307. end;
  308. end;
  309. new_dispose_statement:=p2;
  310. end;
  311. end
  312. else
  313. begin
  314. if (p.resulttype.def.deftype<>pointerdef) then
  315. Begin
  316. Message1(type_e_pointer_type_expected,p.resulttype.def.typename);
  317. new_dispose_statement:=cerrornode.create;
  318. end
  319. else
  320. begin
  321. if (tpointerdef(p.resulttype.def).pointertype.def.deftype=objectdef) and
  322. (oo_has_vmt in tobjectdef(tpointerdef(p.resulttype.def).pointertype.def).objectoptions) then
  323. Message(parser_w_use_extended_syntax_for_objects);
  324. if (tpointerdef(p.resulttype.def).pointertype.def.deftype=orddef) and
  325. (torddef(tpointerdef(p.resulttype.def).pointertype.def).typ=uvoid) then
  326. begin
  327. if (m_tp7 in aktmodeswitches) or
  328. (m_delphi in aktmodeswitches) then
  329. Message(parser_w_no_new_dispose_on_void_pointers)
  330. else
  331. Message(parser_e_no_new_dispose_on_void_pointers);
  332. end;
  333. if is_new then
  334. new_dispose_statement:=csimplenewdisposenode.create(simplenewn,p)
  335. else
  336. new_dispose_statement:=csimplenewdisposenode.create(simpledisposen,p);
  337. end;
  338. end;
  339. consume(_RKLAMMER);
  340. end;
  341. function new_function : tnode;
  342. var
  343. p1,p2 : tnode;
  344. classh : tobjectdef;
  345. sym : tsym;
  346. again : boolean; { dummy for do_proc_call }
  347. begin
  348. consume(_LKLAMMER);
  349. p1:=factor(false);
  350. if p1.nodetype<>typen then
  351. begin
  352. Message(type_e_type_id_expected);
  353. p1.destroy;
  354. p1:=cerrornode.create;
  355. do_resulttypepass(p1);
  356. end;
  357. if (p1.resulttype.def.deftype<>pointerdef) then
  358. Message1(type_e_pointer_type_expected,p1.resulttype.def.typename)
  359. else
  360. if token=_RKLAMMER then
  361. begin
  362. if (tpointerdef(p1.resulttype.def).pointertype.def.deftype=objectdef) and
  363. (oo_has_vmt in tobjectdef(tpointerdef(p1.resulttype.def).pointertype.def).objectoptions) then
  364. Message(parser_w_use_extended_syntax_for_objects);
  365. p2:=cnewnode.create(nil);
  366. do_resulttypepass(p2);
  367. p2.resulttype:=p1.resulttype;
  368. p1.destroy;
  369. p1:=p2;
  370. consume(_RKLAMMER);
  371. end
  372. else
  373. begin
  374. p2:=chnewnode.create;
  375. do_resulttypepass(p2);
  376. p2.resulttype:=tpointerdef(p1.resulttype.def).pointertype;
  377. consume(_COMMA);
  378. afterassignment:=false;
  379. { determines the current object defintion }
  380. classh:=tobjectdef(p2.resulttype.def);
  381. if classh.deftype<>objectdef then
  382. Message(parser_e_pointer_to_class_expected)
  383. else
  384. begin
  385. { check for an abstract class }
  386. if (oo_has_abstract in classh.objectoptions) then
  387. Message(sym_e_no_instance_of_abstract_object);
  388. { search the constructor also in the symbol tables of
  389. the parents }
  390. sym:=nil;
  391. while assigned(classh) do
  392. begin
  393. sym:=tsym(classh.symtable.search(pattern));
  394. if assigned(sym) and
  395. tstoredsym(sym).is_visible_for_proc(aktprocdef) then
  396. break;
  397. classh:=classh.childof;
  398. end;
  399. consume(_ID);
  400. do_member_read(false,sym,p2,again);
  401. { we need to know which procedure is called }
  402. do_resulttypepass(p2);
  403. if (p2.nodetype<>calln) or
  404. (assigned(tcallnode(p2).procdefinition) and
  405. (tcallnode(p2).procdefinition.proctypeoption<>potype_constructor)) then
  406. Message(parser_e_expr_have_to_be_constructor_call);
  407. end;
  408. p2:=cnewnode.create(p2);
  409. do_resulttypepass(p2);
  410. p2.resulttype:=p1.resulttype;
  411. p1.destroy;
  412. p1:=p2;
  413. consume(_RKLAMMER);
  414. end;
  415. new_function:=p1;
  416. end;
  417. function statement_syssym(l : longint) : tnode;
  418. var
  419. p1,p2,paras : tnode;
  420. prev_in_args : boolean;
  421. begin
  422. prev_in_args:=in_args;
  423. case l of
  424. in_new_x :
  425. begin
  426. if afterassignment or in_args then
  427. statement_syssym:=new_function
  428. else
  429. statement_syssym:=new_dispose_statement(true);
  430. end;
  431. in_dispose_x :
  432. begin
  433. statement_syssym:=new_dispose_statement(false);
  434. end;
  435. in_ord_x :
  436. begin
  437. consume(_LKLAMMER);
  438. in_args:=true;
  439. p1:=comp_expr(true);
  440. consume(_RKLAMMER);
  441. p1:=geninlinenode(in_ord_x,false,p1);
  442. statement_syssym := p1;
  443. end;
  444. in_break :
  445. begin
  446. statement_syssym:=cbreaknode.create;
  447. end;
  448. in_continue :
  449. begin
  450. statement_syssym:=ccontinuenode.create;
  451. end;
  452. in_typeof_x :
  453. begin
  454. consume(_LKLAMMER);
  455. in_args:=true;
  456. p1:=comp_expr(true);
  457. consume(_RKLAMMER);
  458. if p1.nodetype=typen then
  459. ttypenode(p1).allowed:=true;
  460. if p1.resulttype.def.deftype=objectdef then
  461. statement_syssym:=geninlinenode(in_typeof_x,false,p1)
  462. else
  463. begin
  464. Message(type_e_mismatch);
  465. p1.destroy;
  466. statement_syssym:=cerrornode.create;
  467. end;
  468. end;
  469. in_sizeof_x :
  470. begin
  471. consume(_LKLAMMER);
  472. in_args:=true;
  473. p1:=comp_expr(true);
  474. consume(_RKLAMMER);
  475. if (p1.nodetype<>typen) and
  476. (
  477. ((p1.resulttype.def.deftype=objectdef) and
  478. (oo_has_constructor in tobjectdef(p1.resulttype.def).objectoptions)) or
  479. is_open_array(p1.resulttype.def) or
  480. is_open_string(p1.resulttype.def)
  481. ) then
  482. statement_syssym:=geninlinenode(in_sizeof_x,false,p1)
  483. else
  484. begin
  485. statement_syssym:=cordconstnode.create(p1.resulttype.def.size,s32bittype);
  486. { p1 not needed !}
  487. p1.destroy;
  488. end;
  489. end;
  490. in_typeinfo_x :
  491. begin
  492. consume(_LKLAMMER);
  493. in_args:=true;
  494. p1:=comp_expr(true);
  495. if p1.nodetype=typen then
  496. ttypenode(p1).allowed:=true
  497. else
  498. begin
  499. p1.destroy;
  500. p1:=cerrornode.create;
  501. Message(parser_e_illegal_parameter_list);
  502. end;
  503. consume(_RKLAMMER);
  504. p2:=ccallparanode.create(p1,nil);
  505. p2:=geninlinenode(in_typeinfo_x,false,p2);
  506. statement_syssym:=p2;
  507. end;
  508. in_assigned_x :
  509. begin
  510. consume(_LKLAMMER);
  511. in_args:=true;
  512. p1:=comp_expr(true);
  513. if not codegenerror then
  514. begin
  515. case p1.resulttype.def.deftype of
  516. pointerdef,
  517. procvardef,
  518. classrefdef : ;
  519. objectdef :
  520. if not is_class_or_interface(p1.resulttype.def) then
  521. Message(parser_e_illegal_parameter_list);
  522. else
  523. Message(parser_e_illegal_parameter_list);
  524. end;
  525. end;
  526. p2:=ccallparanode.create(p1,nil);
  527. p2:=geninlinenode(in_assigned_x,false,p2);
  528. consume(_RKLAMMER);
  529. statement_syssym:=p2;
  530. end;
  531. in_addr_x :
  532. begin
  533. consume(_LKLAMMER);
  534. in_args:=true;
  535. p1:=comp_expr(true);
  536. p1:=caddrnode.create(p1);
  537. consume(_RKLAMMER);
  538. statement_syssym:=p1;
  539. end;
  540. in_ofs_x :
  541. begin
  542. consume(_LKLAMMER);
  543. in_args:=true;
  544. p1:=comp_expr(true);
  545. p1:=caddrnode.create(p1);
  546. do_resulttypepass(p1);
  547. { Ofs() returns a cardinal, not a pointer }
  548. p1.resulttype:=u32bittype;
  549. consume(_RKLAMMER);
  550. statement_syssym:=p1;
  551. end;
  552. in_seg_x :
  553. begin
  554. consume(_LKLAMMER);
  555. in_args:=true;
  556. p1:=comp_expr(true);
  557. p1:=geninlinenode(in_seg_x,false,p1);
  558. consume(_RKLAMMER);
  559. statement_syssym:=p1;
  560. end;
  561. in_high_x,
  562. in_low_x :
  563. begin
  564. consume(_LKLAMMER);
  565. in_args:=true;
  566. p1:=comp_expr(true);
  567. p2:=geninlinenode(l,false,p1);
  568. consume(_RKLAMMER);
  569. statement_syssym:=p2;
  570. end;
  571. in_succ_x,
  572. in_pred_x :
  573. begin
  574. consume(_LKLAMMER);
  575. in_args:=true;
  576. p1:=comp_expr(true);
  577. p2:=geninlinenode(l,false,p1);
  578. consume(_RKLAMMER);
  579. statement_syssym:=p2;
  580. end;
  581. in_inc_x,
  582. in_dec_x :
  583. begin
  584. consume(_LKLAMMER);
  585. in_args:=true;
  586. p1:=comp_expr(true);
  587. if token=_COMMA then
  588. begin
  589. consume(_COMMA);
  590. p2:=ccallparanode.create(comp_expr(true),nil);
  591. end
  592. else
  593. p2:=nil;
  594. p2:=ccallparanode.create(p1,p2);
  595. statement_syssym:=geninlinenode(l,false,p2);
  596. consume(_RKLAMMER);
  597. end;
  598. in_finalize_x:
  599. begin
  600. consume(_LKLAMMER);
  601. in_args:=true;
  602. p1:=comp_expr(true);
  603. if token=_COMMA then
  604. begin
  605. consume(_COMMA);
  606. p2:=ccallparanode.create(comp_expr(true),nil);
  607. end
  608. else
  609. p2:=nil;
  610. p2:=ccallparanode.create(p1,p2);
  611. statement_syssym:=geninlinenode(in_finalize_x,false,p2);
  612. consume(_RKLAMMER);
  613. end;
  614. in_concat_x :
  615. begin
  616. consume(_LKLAMMER);
  617. in_args:=true;
  618. p2:=nil;
  619. while true do
  620. begin
  621. p1:=comp_expr(true);
  622. set_varstate(p1,true);
  623. if not((p1.resulttype.def.deftype=stringdef) or
  624. ((p1.resulttype.def.deftype=orddef) and
  625. (torddef(p1.resulttype.def).typ=uchar))) then
  626. Message(parser_e_illegal_parameter_list);
  627. if p2<>nil then
  628. p2:=caddnode.create(addn,p2,p1)
  629. else
  630. p2:=p1;
  631. if token=_COMMA then
  632. consume(_COMMA)
  633. else
  634. break;
  635. end;
  636. consume(_RKLAMMER);
  637. statement_syssym:=p2;
  638. end;
  639. in_read_x,
  640. in_readln_x :
  641. begin
  642. if token=_LKLAMMER then
  643. begin
  644. consume(_LKLAMMER);
  645. in_args:=true;
  646. paras:=parse_paras(false,false);
  647. consume(_RKLAMMER);
  648. end
  649. else
  650. paras:=nil;
  651. p1:=geninlinenode(l,false,paras);
  652. statement_syssym := p1;
  653. end;
  654. in_setlength_x:
  655. begin
  656. if token=_LKLAMMER then
  657. begin
  658. consume(_LKLAMMER);
  659. in_args:=true;
  660. paras:=parse_paras(false,false);
  661. consume(_RKLAMMER);
  662. end
  663. else
  664. paras:=nil;
  665. p1:=geninlinenode(l,false,paras);
  666. statement_syssym := p1;
  667. end;
  668. in_length_x:
  669. begin
  670. consume(_LKLAMMER);
  671. in_args:=true;
  672. p1:=comp_expr(true);
  673. p2:=geninlinenode(l,false,p1);
  674. consume(_RKLAMMER);
  675. statement_syssym:=p2;
  676. end;
  677. in_write_x,
  678. in_writeln_x :
  679. begin
  680. if token=_LKLAMMER then
  681. begin
  682. consume(_LKLAMMER);
  683. in_args:=true;
  684. paras:=parse_paras(true,false);
  685. consume(_RKLAMMER);
  686. end
  687. else
  688. paras:=nil;
  689. p1 := geninlinenode(l,false,paras);
  690. statement_syssym := p1;
  691. end;
  692. in_str_x_string :
  693. begin
  694. consume(_LKLAMMER);
  695. in_args:=true;
  696. paras:=parse_paras(true,false);
  697. consume(_RKLAMMER);
  698. p1 := geninlinenode(l,false,paras);
  699. statement_syssym := p1;
  700. end;
  701. in_val_x:
  702. Begin
  703. consume(_LKLAMMER);
  704. in_args := true;
  705. p1:= ccallparanode.create(comp_expr(true), nil);
  706. consume(_COMMA);
  707. p2 := ccallparanode.create(comp_expr(true),p1);
  708. if (token = _COMMA) then
  709. Begin
  710. consume(_COMMA);
  711. p2 := ccallparanode.create(comp_expr(true),p2)
  712. End;
  713. consume(_RKLAMMER);
  714. p2 := geninlinenode(l,false,p2);
  715. statement_syssym := p2;
  716. End;
  717. in_include_x_y,
  718. in_exclude_x_y :
  719. begin
  720. consume(_LKLAMMER);
  721. in_args:=true;
  722. p1:=comp_expr(true);
  723. consume(_COMMA);
  724. p2:=comp_expr(true);
  725. statement_syssym:=geninlinenode(l,false,ccallparanode.create(p1,ccallparanode.create(p2,nil)));
  726. consume(_RKLAMMER);
  727. end;
  728. in_assert_x_y :
  729. begin
  730. consume(_LKLAMMER);
  731. in_args:=true;
  732. p1:=comp_expr(true);
  733. if token=_COMMA then
  734. begin
  735. consume(_COMMA);
  736. p2:=comp_expr(true);
  737. end
  738. else
  739. begin
  740. { then insert an empty string }
  741. p2:=cstringconstnode.createstr('',st_default);
  742. end;
  743. statement_syssym:=geninlinenode(l,false,ccallparanode.create(p1,ccallparanode.create(p2,nil)));
  744. consume(_RKLAMMER);
  745. end;
  746. else
  747. internalerror(15);
  748. end;
  749. in_args:=prev_in_args;
  750. end;
  751. { reads the parameter for a subroutine call }
  752. procedure do_proc_call(sym:tsym;st:tsymtable;getaddr:boolean;var again : boolean;var p1:tnode);
  753. var
  754. prevafterassn : boolean;
  755. hs,hs1 : tvarsym;
  756. para,p2 : tnode;
  757. hst : tsymtable;
  758. aprocdef : tprocdef;
  759. begin
  760. prevafterassn:=afterassignment;
  761. afterassignment:=false;
  762. { want we only determine the address of }
  763. { a subroutine ? }
  764. if not(getaddr) then
  765. begin
  766. para:=nil;
  767. if auto_inherited then
  768. begin
  769. hst:=symtablestack;
  770. while assigned(hst) and (hst.symtabletype<>parasymtable) do
  771. hst:=hst.next;
  772. if assigned(hst) then
  773. begin
  774. hs:=tvarsym(hst.symindex.first);
  775. while assigned(hs) do
  776. begin
  777. if hs.typ<>varsym then
  778. internalerror(54382953);
  779. { if there is a localcopy then use that }
  780. if assigned(hs.localvarsym) then
  781. hs1:=hs.localvarsym
  782. else
  783. hs1:=hs;
  784. para:=ccallparanode.create(cloadnode.create(hs1,hs1.owner),para);
  785. hs:=tvarsym(hs.indexnext);
  786. end;
  787. end
  788. else
  789. internalerror(54382954);
  790. end
  791. else
  792. begin
  793. if token=_LKLAMMER then
  794. begin
  795. consume(_LKLAMMER);
  796. para:=parse_paras(false,false);
  797. consume(_RKLAMMER);
  798. end;
  799. end;
  800. p1:=ccallnode.create(para,tprocsym(sym),st,p1);
  801. end
  802. else
  803. begin
  804. { address operator @: }
  805. if not assigned(p1) then
  806. begin
  807. if (st.symtabletype=withsymtable) and
  808. (st.defowner.deftype=objectdef) then
  809. begin
  810. p1:=tnode(twithsymtable(st).withrefnode).getcopy;
  811. end
  812. else
  813. begin
  814. { we must provide a method pointer, if it isn't given, }
  815. { it is self }
  816. if (st.symtabletype=objectsymtable) then
  817. p1:=cselfnode.create(tobjectdef(st.defowner));
  818. end;
  819. end;
  820. { generate a methodcallnode or proccallnode }
  821. { we shouldn't convert things like @tcollection.load }
  822. if assigned(getprocvardef) then
  823. aprocdef:=get_proc_2_procvar_def(tprocsym(sym),getprocvardef)
  824. else
  825. aprocdef:=nil;
  826. p2:=cloadnode.create_procvar(sym,aprocdef,st);
  827. if assigned(p1) then
  828. tloadnode(p2).set_mp(p1);
  829. p1:=p2;
  830. { no postfix operators }
  831. again:=false;
  832. end;
  833. afterassignment:=prevafterassn;
  834. end;
  835. procedure handle_procvar(pv : tprocvardef;var p2 : tnode; getaddr: boolean);
  836. procedure doconv(procvar : tprocvardef;var t : tnode);
  837. var
  838. hp : tnode;
  839. currprocdef : tprocdef;
  840. begin
  841. hp:=nil;
  842. currprocdef:=get_proc_2_procvar_def(tcallnode(t).symtableprocentry,procvar);
  843. if assigned(currprocdef) then
  844. begin
  845. hp:=cloadnode.create_procvar(tprocsym(tcallnode(t).symtableprocentry),currprocdef,tcallnode(t).symtableproc);
  846. if (po_methodpointer in procvar.procoptions) then
  847. tloadnode(hp).set_mp(tnode(tcallnode(t).methodpointer).getcopy);
  848. t.destroy;
  849. t:=hp;
  850. end;
  851. end;
  852. begin
  853. if ((m_tp_procvar in aktmodeswitches) or
  854. not getaddr) then
  855. if (p2.nodetype=calln) then
  856. doconv(pv,p2)
  857. else
  858. if (p2.nodetype=typeconvn) and
  859. (ttypeconvnode(p2).left.nodetype=calln) then
  860. doconv(pv,ttypeconvnode(p2).left);
  861. end;
  862. { the following procedure handles the access to a property symbol }
  863. procedure handle_propertysym(sym : tsym;st : tsymtable;var p1 : tnode; getaddr: boolean);
  864. procedure symlist_to_node(var p1:tnode;pl:tsymlist);
  865. var
  866. plist : psymlistitem;
  867. begin
  868. plist:=pl.firstsym;
  869. while assigned(plist) do
  870. begin
  871. case plist^.sltype of
  872. sl_load :
  873. begin
  874. { p1 can already contain the loadnode of
  875. the class variable. Then we need to use a
  876. subscriptn. If no tree is found (with block), then
  877. generate a loadn }
  878. if assigned(p1) then
  879. p1:=csubscriptnode.create(tvarsym(plist^.sym),p1)
  880. else
  881. p1:=cloadnode.create(tvarsym(plist^.sym),st);
  882. end;
  883. sl_subscript :
  884. p1:=csubscriptnode.create(tvarsym(plist^.sym),p1);
  885. sl_vec :
  886. p1:=cvecnode.create(p1,cordconstnode.create(plist^.value,s32bittype));
  887. else
  888. internalerror(200110205);
  889. end;
  890. plist:=plist^.next;
  891. end;
  892. include(p1.flags,nf_isproperty);
  893. end;
  894. var
  895. paras : tnode;
  896. p2 : tnode;
  897. begin
  898. paras:=nil;
  899. { property parameters? read them only if the property really }
  900. { has parameters }
  901. if (ppo_hasparameters in tpropertysym(sym).propoptions) then
  902. begin
  903. if token=_LECKKLAMMER then
  904. begin
  905. consume(_LECKKLAMMER);
  906. paras:=parse_paras(false,true);
  907. consume(_RECKKLAMMER);
  908. end;
  909. end;
  910. { indexed property }
  911. if (ppo_indexed in tpropertysym(sym).propoptions) then
  912. begin
  913. p2:=cordconstnode.create(tpropertysym(sym).index,tpropertysym(sym).indextype);
  914. paras:=ccallparanode.create(p2,paras);
  915. end;
  916. { we need only a write property if a := follows }
  917. { if not(afterassignment) and not(in_args) then }
  918. if token=_ASSIGNMENT then
  919. begin
  920. { write property: }
  921. if not tpropertysym(sym).writeaccess.empty then
  922. begin
  923. case tpropertysym(sym).writeaccess.firstsym^.sym.typ of
  924. procsym :
  925. begin
  926. { generate the method call }
  927. p1:=ccallnode.create(paras,
  928. tprocsym(tpropertysym(sym).writeaccess.firstsym^.sym),st,p1);
  929. paras:=nil;
  930. consume(_ASSIGNMENT);
  931. { read the expression }
  932. if tpropertysym(sym).proptype.def.deftype=procvardef then
  933. getprocvardef:=tprocvardef(tpropertysym(sym).proptype.def);
  934. p2:=comp_expr(true);
  935. if assigned(getprocvardef) then
  936. handle_procvar(getprocvardef,p2,getaddr);
  937. tcallnode(p1).left:=ccallparanode.create(p2,tcallnode(p1).left);
  938. include(tcallnode(p1).flags,nf_isproperty);
  939. getprocvardef:=nil;
  940. end;
  941. varsym :
  942. begin
  943. { generate access code }
  944. symlist_to_node(p1,tpropertysym(sym).writeaccess);
  945. consume(_ASSIGNMENT);
  946. { read the expression }
  947. p2:=comp_expr(true);
  948. p1:=cassignmentnode.create(p1,p2);
  949. end
  950. else
  951. begin
  952. p1:=cerrornode.create;
  953. Message(parser_e_no_procedure_to_access_property);
  954. end;
  955. end;
  956. end
  957. else
  958. begin
  959. p1:=cerrornode.create;
  960. Message(parser_e_no_procedure_to_access_property);
  961. end;
  962. end
  963. else
  964. begin
  965. { read property: }
  966. if not tpropertysym(sym).readaccess.empty then
  967. begin
  968. case tpropertysym(sym).readaccess.firstsym^.sym.typ of
  969. varsym :
  970. begin
  971. { generate access code }
  972. symlist_to_node(p1,tpropertysym(sym).readaccess);
  973. end;
  974. procsym :
  975. begin
  976. { generate the method call }
  977. p1:=ccallnode.create(paras,tprocsym(tpropertysym(sym).readaccess.firstsym^.sym),st,p1);
  978. paras:=nil;
  979. include(p1.flags,nf_isproperty);
  980. end
  981. else
  982. begin
  983. p1:=cerrornode.create;
  984. Message(type_e_mismatch);
  985. end;
  986. end;
  987. end
  988. else
  989. begin
  990. { error, no function to read property }
  991. p1:=cerrornode.create;
  992. Message(parser_e_no_procedure_to_access_property);
  993. end;
  994. end;
  995. { release paras if not used }
  996. if assigned(paras) then
  997. paras.free;
  998. end;
  999. { the ID token has to be consumed before calling this function }
  1000. procedure do_member_read(getaddr : boolean;sym : tsym;var p1 : tnode;var again : boolean);
  1001. var
  1002. static_name : string;
  1003. isclassref : boolean;
  1004. srsymtable : tsymtable;
  1005. begin
  1006. if sym=nil then
  1007. begin
  1008. { pattern is still valid unless
  1009. there is another ID just after the ID of sym }
  1010. Message1(sym_e_id_no_member,pattern);
  1011. p1.free;
  1012. p1:=cerrornode.create;
  1013. { try to clean up }
  1014. again:=false;
  1015. end
  1016. else
  1017. begin
  1018. if assigned(p1) then
  1019. begin
  1020. if not assigned(p1.resulttype.def) then
  1021. do_resulttypepass(p1);
  1022. isclassref:=(p1.resulttype.def.deftype=classrefdef);
  1023. end
  1024. else
  1025. isclassref:=false;
  1026. { we assume, that only procsyms and varsyms are in an object }
  1027. { symbol table, for classes, properties are allowed }
  1028. case sym.typ of
  1029. procsym:
  1030. begin
  1031. do_proc_call(sym,sym.owner,
  1032. getaddr or
  1033. (assigned(getprocvardef) and
  1034. ((block_type=bt_const) or
  1035. ((m_tp_procvar in aktmodeswitches) and
  1036. proc_to_procvar_equal(tprocsym(sym).defs^.def,getprocvardef,false)
  1037. )
  1038. )
  1039. ),again,p1);
  1040. if (block_type=bt_const) and
  1041. assigned(getprocvardef) then
  1042. handle_procvar(getprocvardef,p1,getaddr);
  1043. { we need to know which procedure is called }
  1044. do_resulttypepass(p1);
  1045. { now we know the real method e.g. we can check for a class method }
  1046. if isclassref and
  1047. assigned(tcallnode(p1).procdefinition) and
  1048. not(po_classmethod in tcallnode(p1).procdefinition.procoptions) and
  1049. not(tcallnode(p1).procdefinition.proctypeoption=potype_constructor) then
  1050. Message(parser_e_only_class_methods_via_class_ref);
  1051. end;
  1052. varsym:
  1053. begin
  1054. if isclassref then
  1055. Message(parser_e_only_class_methods_via_class_ref);
  1056. if (sp_static in sym.symoptions) then
  1057. begin
  1058. static_name:=lower(sym.owner.name^)+'_'+sym.name;
  1059. searchsym(static_name,sym,srsymtable);
  1060. p1.free;
  1061. p1:=cloadnode.create(tvarsym(sym),srsymtable);
  1062. end
  1063. else
  1064. p1:=csubscriptnode.create(tvarsym(sym),p1);
  1065. end;
  1066. propertysym:
  1067. begin
  1068. if isclassref then
  1069. Message(parser_e_only_class_methods_via_class_ref);
  1070. handle_propertysym(sym,sym.owner,p1,getaddr);
  1071. end;
  1072. else internalerror(16);
  1073. end;
  1074. end;
  1075. end;
  1076. {****************************************************************************
  1077. Factor
  1078. ****************************************************************************}
  1079. {$ifdef fpc}
  1080. {$maxfpuregisters 0}
  1081. {$endif fpc}
  1082. function factor(getaddr : boolean) : tnode;
  1083. {---------------------------------------------
  1084. Is_func_ret
  1085. ---------------------------------------------}
  1086. function is_func_ret(var p1:tnode;var sym : tsym;var srsymtable:tsymtable) : boolean;
  1087. var
  1088. p : pprocinfo;
  1089. storesymtablestack : tsymtable;
  1090. begin
  1091. is_func_ret:=false;
  1092. if not assigned(procinfo) or
  1093. ((sym.typ<>funcretsym) and ((procinfo^.flags and pi_operator)=0)) then
  1094. exit;
  1095. p:=procinfo;
  1096. while assigned(p) do
  1097. begin
  1098. { is this an access to a function result? Accessing _RESULT is
  1099. always allowed and funcretn is generated }
  1100. if assigned(p^.procdef.funcretsym) and
  1101. ((tfuncretsym(sym)=p^.procdef.resultfuncretsym) or
  1102. ((tfuncretsym(sym)=p^.procdef.funcretsym) or
  1103. ((tvarsym(sym)=otsym) and ((p^.flags and pi_operator)<>0))) and
  1104. (not is_void(p^.procdef.rettype.def)) and
  1105. (token<>_LKLAMMER) and
  1106. (not (not(m_fpc in aktmodeswitches) and (afterassignment or in_args)))
  1107. ) then
  1108. begin
  1109. if ((tvarsym(sym)=otsym) and
  1110. ((p^.flags and pi_operator)<>0)) then
  1111. inc(otsym.refs);
  1112. p1:=cfuncretnode.create(p^.procdef.funcretsym);
  1113. is_func_ret:=true;
  1114. if tfuncretsym(p^.procdef.funcretsym).funcretstate=vs_declared then
  1115. begin
  1116. tfuncretsym(p^.procdef.funcretsym).funcretstate:=vs_declared_and_first_found;
  1117. include(p1.flags,nf_is_first_funcret);
  1118. end;
  1119. exit;
  1120. end;
  1121. p:=p^.parent;
  1122. end;
  1123. { we must use the function call, update the
  1124. sym to be the procsym }
  1125. if (sym.typ=funcretsym) then
  1126. begin
  1127. storesymtablestack:=symtablestack;
  1128. symtablestack:=sym.owner.next;
  1129. searchsym(sym.name,sym,srsymtable);
  1130. if not assigned(sym) then
  1131. sym:=generrorsym;
  1132. if (sym.typ<>procsym) then
  1133. Message(cg_e_illegal_expression);
  1134. symtablestack:=storesymtablestack;
  1135. end;
  1136. end;
  1137. {---------------------------------------------
  1138. Factor_read_id
  1139. ---------------------------------------------}
  1140. procedure factor_read_id(var p1:tnode;var again:boolean);
  1141. var
  1142. pc : pchar;
  1143. len : longint;
  1144. srsym : tsym;
  1145. possible_error : boolean;
  1146. srsymtable : tsymtable;
  1147. htype : ttype;
  1148. static_name : string;
  1149. begin
  1150. { allow post fix operators }
  1151. again:=true;
  1152. consume_sym(srsym,srsymtable);
  1153. if not is_func_ret(p1,srsym,srsymtable) then
  1154. begin
  1155. { check semantics of private }
  1156. if (srsym.typ in [propertysym,procsym,varsym]) and
  1157. (srsym.owner.symtabletype=objectsymtable) then
  1158. begin
  1159. if (sp_private in srsym.symoptions) and
  1160. (tobjectdef(srsym.owner.defowner).owner.symtabletype=globalsymtable) and
  1161. (tobjectdef(srsym.owner.defowner).owner.unitid<>0) then
  1162. Message(parser_e_cant_access_private_member);
  1163. end;
  1164. case srsym.typ of
  1165. absolutesym :
  1166. begin
  1167. p1:=cloadnode.create(tvarsym(srsym),srsymtable);
  1168. end;
  1169. varsym :
  1170. begin
  1171. { are we in a class method ? }
  1172. if (srsym.owner.symtabletype=objectsymtable) and
  1173. assigned(aktprocsym) and
  1174. (po_classmethod in aktprocdef.procoptions) then
  1175. Message(parser_e_only_class_methods);
  1176. if (sp_static in srsym.symoptions) then
  1177. begin
  1178. static_name:=lower(srsym.owner.name^)+'_'+srsym.name;
  1179. searchsym(static_name,srsym,srsymtable);
  1180. end;
  1181. p1:=cloadnode.create(tvarsym(srsym),srsymtable);
  1182. if tvarsym(srsym).varstate=vs_declared then
  1183. begin
  1184. include(p1.flags,nf_first);
  1185. { set special between first loaded until checked in resulttypepass }
  1186. tvarsym(srsym).varstate:=vs_declared_and_first_found;
  1187. end;
  1188. end;
  1189. typedconstsym :
  1190. begin
  1191. p1:=cloadnode.create(srsym,srsymtable);
  1192. end;
  1193. syssym :
  1194. begin
  1195. p1:=statement_syssym(tsyssym(srsym).number);
  1196. end;
  1197. typesym :
  1198. begin
  1199. htype.setsym(srsym);
  1200. if not assigned(htype.def) then
  1201. begin
  1202. again:=false;
  1203. end
  1204. else
  1205. begin
  1206. if token=_LKLAMMER then
  1207. begin
  1208. consume(_LKLAMMER);
  1209. p1:=comp_expr(true);
  1210. consume(_RKLAMMER);
  1211. p1:=ctypeconvnode.create(p1,htype);
  1212. include(p1.flags,nf_explizit);
  1213. end
  1214. else { not LKLAMMER }
  1215. if (token=_POINT) and
  1216. is_object(htype.def) then
  1217. begin
  1218. consume(_POINT);
  1219. if assigned(procinfo) and
  1220. assigned(procinfo^._class) and
  1221. not(getaddr) then
  1222. begin
  1223. if procinfo^._class.is_related(tobjectdef(htype.def)) then
  1224. begin
  1225. p1:=ctypenode.create(htype);
  1226. { search also in inherited methods }
  1227. repeat
  1228. srsym:=tvarsym(tobjectdef(htype.def).symtable.search(pattern));
  1229. if assigned(srsym) and
  1230. tstoredsym(srsym).is_visible_for_proc(aktprocdef) then
  1231. break;
  1232. htype.def:=tobjectdef(htype.def).childof;
  1233. until not assigned(htype.def);
  1234. consume(_ID);
  1235. do_member_read(false,srsym,p1,again);
  1236. end
  1237. else
  1238. begin
  1239. Message(parser_e_no_super_class);
  1240. again:=false;
  1241. end;
  1242. end
  1243. else
  1244. begin
  1245. { allows @TObject.Load }
  1246. { also allows static methods and variables }
  1247. p1:=ctypenode.create(htype);
  1248. { TP allows also @TMenu.Load if Load is only }
  1249. { defined in an anchestor class }
  1250. srsym:=tvarsym(search_class_member(tobjectdef(htype.def),pattern));
  1251. if not assigned(srsym) then
  1252. Message1(sym_e_id_no_member,pattern)
  1253. else if not(getaddr) and not(sp_static in srsym.symoptions) then
  1254. Message(sym_e_only_static_in_static)
  1255. else
  1256. begin
  1257. consume(_ID);
  1258. do_member_read(getaddr,srsym,p1,again);
  1259. end;
  1260. end;
  1261. end
  1262. else
  1263. begin
  1264. { class reference ? }
  1265. if is_class(htype.def) then
  1266. begin
  1267. if getaddr and (token=_POINT) then
  1268. begin
  1269. consume(_POINT);
  1270. { allows @Object.Method }
  1271. { also allows static methods and variables }
  1272. p1:=ctypenode.create(htype);
  1273. { TP allows also @TMenu.Load if Load is only }
  1274. { defined in an anchestor class }
  1275. srsym:=tvarsym(search_class_member(tobjectdef(htype.def),pattern));
  1276. if not assigned(srsym) then
  1277. Message1(sym_e_id_no_member,pattern)
  1278. else
  1279. begin
  1280. consume(_ID);
  1281. do_member_read(getaddr,srsym,p1,again);
  1282. end;
  1283. end
  1284. else
  1285. begin
  1286. p1:=ctypenode.create(htype);
  1287. { For a type block we simply return only
  1288. the type. For all other blocks we return
  1289. a loadvmt node }
  1290. if (block_type<>bt_type) then
  1291. p1:=cloadvmtnode.create(p1);
  1292. end;
  1293. end
  1294. else
  1295. p1:=ctypenode.create(htype);
  1296. end;
  1297. end;
  1298. end;
  1299. enumsym :
  1300. begin
  1301. p1:=genenumnode(tenumsym(srsym));
  1302. end;
  1303. constsym :
  1304. begin
  1305. case tconstsym(srsym).consttyp of
  1306. constint :
  1307. begin
  1308. { do a very dirty trick to bootstrap this code }
  1309. if (tconstsym(srsym).valueord>=-(int64(2147483647)+int64(1))) and
  1310. (tconstsym(srsym).valueord<=2147483647) then
  1311. p1:=cordconstnode.create(tconstsym(srsym).valueord,s32bittype)
  1312. else if (tconstsym(srsym).valueord > maxlongint) and
  1313. (tconstsym(srsym).valueord <= int64(maxlongint)+int64(maxlongint)+1) then
  1314. p1:=cordconstnode.create(tconstsym(srsym).valueord,u32bittype)
  1315. else
  1316. p1:=cordconstnode.create(tconstsym(srsym).valueord,cs64bittype);
  1317. end;
  1318. conststring :
  1319. begin
  1320. len:=tconstsym(srsym).len;
  1321. if not(cs_ansistrings in aktlocalswitches) and (len>255) then
  1322. len:=255;
  1323. getmem(pc,len+1);
  1324. move(pchar(tconstsym(srsym).valueptr)^,pc^,len);
  1325. pc[len]:=#0;
  1326. p1:=cstringconstnode.createpchar(pc,len);
  1327. end;
  1328. constchar :
  1329. p1:=cordconstnode.create(tconstsym(srsym).valueord,cchartype);
  1330. constreal :
  1331. p1:=crealconstnode.create(pbestreal(tconstsym(srsym).valueptr)^,pbestrealtype^);
  1332. constbool :
  1333. p1:=cordconstnode.create(tconstsym(srsym).valueord,booltype);
  1334. constset :
  1335. p1:=csetconstnode.create(pconstset(tconstsym(srsym).valueptr),tconstsym(srsym).consttype);
  1336. constord :
  1337. p1:=cordconstnode.create(tconstsym(srsym).valueord,tconstsym(srsym).consttype);
  1338. constpointer :
  1339. p1:=cpointerconstnode.create(tconstsym(srsym).valueordptr,tconstsym(srsym).consttype);
  1340. constnil :
  1341. p1:=cnilnode.create;
  1342. constresourcestring:
  1343. begin
  1344. p1:=cloadnode.create(tvarsym(srsym),srsymtable);
  1345. do_resulttypepass(p1);
  1346. p1.resulttype:=cansistringtype;
  1347. end;
  1348. constguid :
  1349. p1:=cguidconstnode.create(pguid(tconstsym(srsym).valueptr)^);
  1350. end;
  1351. end;
  1352. procsym :
  1353. begin
  1354. { are we in a class method ? }
  1355. possible_error:=(srsym.owner.symtabletype=objectsymtable) and
  1356. assigned(aktprocsym) and
  1357. (po_classmethod in aktprocdef.procoptions);
  1358. do_proc_call(srsym,srsymtable,
  1359. getaddr or
  1360. (assigned(getprocvardef) and
  1361. ((block_type=bt_const) or
  1362. ((m_tp_procvar in aktmodeswitches) and
  1363. proc_to_procvar_equal(tprocsym(srsym).defs^.def,getprocvardef,false)
  1364. )
  1365. )
  1366. ),again,p1);
  1367. if (block_type=bt_const) and
  1368. assigned(getprocvardef) then
  1369. handle_procvar(getprocvardef,p1,getaddr);
  1370. { we need to know which procedure is called }
  1371. if possible_error then
  1372. begin
  1373. do_resulttypepass(p1);
  1374. if not(po_classmethod in tcallnode(p1).procdefinition.procoptions) then
  1375. Message(parser_e_only_class_methods);
  1376. end;
  1377. end;
  1378. propertysym :
  1379. begin
  1380. { access to property in a method }
  1381. { are we in a class method ? }
  1382. if (srsym.owner.symtabletype=objectsymtable) and
  1383. assigned(aktprocsym) and
  1384. (po_classmethod in aktprocdef.procoptions) then
  1385. Message(parser_e_only_class_methods);
  1386. { no method pointer }
  1387. p1:=nil;
  1388. handle_propertysym(srsym,srsymtable,p1,getaddr);
  1389. end;
  1390. labelsym :
  1391. begin
  1392. consume(_COLON);
  1393. if tlabelsym(srsym).defined then
  1394. Message(sym_e_label_already_defined);
  1395. tlabelsym(srsym).defined:=true;
  1396. p1:=clabelnode.create(tlabelsym(srsym),nil);
  1397. end;
  1398. errorsym :
  1399. begin
  1400. p1:=cerrornode.create;
  1401. if token=_LKLAMMER then
  1402. begin
  1403. consume(_LKLAMMER);
  1404. parse_paras(false,false);
  1405. consume(_RKLAMMER);
  1406. end;
  1407. end;
  1408. else
  1409. begin
  1410. p1:=cerrornode.create;
  1411. Message(cg_e_illegal_expression);
  1412. end;
  1413. end; { end case }
  1414. end;
  1415. end;
  1416. {---------------------------------------------
  1417. Factor_Read_Set
  1418. ---------------------------------------------}
  1419. { Read a set between [] }
  1420. function factor_read_set:tnode;
  1421. var
  1422. p1,p2 : tnode;
  1423. lastp,
  1424. buildp : tarrayconstructornode;
  1425. begin
  1426. buildp:=nil;
  1427. { be sure that a least one arrayconstructn is used, also for an
  1428. empty [] }
  1429. if token=_RECKKLAMMER then
  1430. buildp:=carrayconstructornode.create(nil,buildp)
  1431. else
  1432. begin
  1433. while true do
  1434. begin
  1435. p1:=comp_expr(true);
  1436. if token=_POINTPOINT then
  1437. begin
  1438. consume(_POINTPOINT);
  1439. p2:=comp_expr(true);
  1440. p1:=carrayconstructorrangenode.create(p1,p2);
  1441. end;
  1442. { insert at the end of the tree, to get the correct order }
  1443. if not assigned(buildp) then
  1444. begin
  1445. buildp:=carrayconstructornode.create(p1,nil);
  1446. lastp:=buildp;
  1447. end
  1448. else
  1449. begin
  1450. lastp.right:=carrayconstructornode.create(p1,nil);
  1451. lastp:=tarrayconstructornode(lastp.right);
  1452. end;
  1453. { there could be more elements }
  1454. if token=_COMMA then
  1455. consume(_COMMA)
  1456. else
  1457. break;
  1458. end;
  1459. end;
  1460. factor_read_set:=buildp;
  1461. end;
  1462. {---------------------------------------------
  1463. PostFixOperators
  1464. ---------------------------------------------}
  1465. procedure postfixoperators(var p1:tnode;var again:boolean);
  1466. { tries to avoid syntax errors after invalid qualifiers }
  1467. procedure recoverconsume_postfixops;
  1468. begin
  1469. while true do
  1470. begin
  1471. case token of
  1472. _CARET:
  1473. consume(_CARET);
  1474. _POINT:
  1475. begin
  1476. consume(_POINT);
  1477. if token=_ID then
  1478. consume(_ID);
  1479. end;
  1480. _LECKKLAMMER:
  1481. begin
  1482. consume(_LECKKLAMMER);
  1483. repeat
  1484. comp_expr(true);
  1485. if token=_COMMA then
  1486. consume(_COMMA)
  1487. else
  1488. break;
  1489. until false;
  1490. consume(_RECKKLAMMER);
  1491. end
  1492. else
  1493. break;
  1494. end;
  1495. end;
  1496. end;
  1497. var
  1498. store_static : boolean;
  1499. protsym : tpropertysym;
  1500. p2,p3 : tnode;
  1501. hsym : tsym;
  1502. classh : tobjectdef;
  1503. begin
  1504. again:=true;
  1505. while again do
  1506. begin
  1507. { we need the resulttype }
  1508. do_resulttypepass(p1);
  1509. if codegenerror then
  1510. begin
  1511. recoverconsume_postfixops;
  1512. exit;
  1513. end;
  1514. { handle token }
  1515. case token of
  1516. _CARET:
  1517. begin
  1518. consume(_CARET);
  1519. if (p1.resulttype.def.deftype<>pointerdef) then
  1520. begin
  1521. { ^ as binary operator is a problem!!!! (FK) }
  1522. again:=false;
  1523. Message(cg_e_invalid_qualifier);
  1524. recoverconsume_postfixops;
  1525. p1.destroy;
  1526. p1:=cerrornode.create;
  1527. end
  1528. else
  1529. begin
  1530. p1:=cderefnode.create(p1);
  1531. end;
  1532. end;
  1533. _LECKKLAMMER:
  1534. begin
  1535. if is_class_or_interface(p1.resulttype.def) then
  1536. begin
  1537. { default property }
  1538. protsym:=search_default_property(tobjectdef(p1.resulttype.def));
  1539. if not(assigned(protsym)) then
  1540. begin
  1541. p1.destroy;
  1542. p1:=cerrornode.create;
  1543. again:=false;
  1544. message(parser_e_no_default_property_available);
  1545. end
  1546. else
  1547. handle_propertysym(protsym,protsym.owner,p1,getaddr);
  1548. end
  1549. else
  1550. begin
  1551. consume(_LECKKLAMMER);
  1552. repeat
  1553. case p1.resulttype.def.deftype of
  1554. pointerdef:
  1555. begin
  1556. { support delphi autoderef }
  1557. if (tpointerdef(p1.resulttype.def).pointertype.def.deftype=arraydef) and
  1558. (m_autoderef in aktmodeswitches) then
  1559. begin
  1560. p1:=cderefnode.create(p1);
  1561. end;
  1562. p2:=comp_expr(true);
  1563. p1:=cvecnode.create(p1,p2);
  1564. end;
  1565. stringdef :
  1566. begin
  1567. p2:=comp_expr(true);
  1568. p1:=cvecnode.create(p1,p2);
  1569. end;
  1570. arraydef :
  1571. begin
  1572. p2:=comp_expr(true);
  1573. { support SEG:OFS for go32v2 Mem[] }
  1574. if (target_info.target=target_i386_go32v2) and
  1575. (p1.nodetype=loadn) and
  1576. assigned(tloadnode(p1).symtableentry) and
  1577. assigned(tloadnode(p1).symtableentry.owner.name) and
  1578. (tloadnode(p1).symtableentry.owner.name^='SYSTEM') and
  1579. ((tloadnode(p1).symtableentry.name='MEM') or
  1580. (tloadnode(p1).symtableentry.name='MEMW') or
  1581. (tloadnode(p1).symtableentry.name='MEML')) then
  1582. begin
  1583. if (token=_COLON) then
  1584. begin
  1585. consume(_COLON);
  1586. p3:=caddnode.create(muln,cordconstnode.create($10,s32bittype),p2);
  1587. p2:=comp_expr(true);
  1588. p2:=caddnode.create(addn,p2,p3);
  1589. p1:=cvecnode.create(p1,p2);
  1590. include(tvecnode(p1).flags,nf_memseg);
  1591. include(tvecnode(p1).flags,nf_memindex);
  1592. end
  1593. else
  1594. begin
  1595. p1:=cvecnode.create(p1,p2);
  1596. include(tvecnode(p1).flags,nf_memindex);
  1597. end;
  1598. end
  1599. else
  1600. p1:=cvecnode.create(p1,p2);
  1601. end;
  1602. else
  1603. begin
  1604. Message(cg_e_invalid_qualifier);
  1605. p1.destroy;
  1606. p1:=cerrornode.create;
  1607. comp_expr(true);
  1608. again:=false;
  1609. end;
  1610. end;
  1611. do_resulttypepass(p1);
  1612. if token=_COMMA then
  1613. consume(_COMMA)
  1614. else
  1615. break;
  1616. until false;
  1617. consume(_RECKKLAMMER);
  1618. end;
  1619. end;
  1620. _POINT :
  1621. begin
  1622. consume(_POINT);
  1623. if (p1.resulttype.def.deftype=pointerdef) and
  1624. (m_autoderef in aktmodeswitches) then
  1625. begin
  1626. p1:=cderefnode.create(p1);
  1627. do_resulttypepass(p1);
  1628. end;
  1629. case p1.resulttype.def.deftype of
  1630. recorddef:
  1631. begin
  1632. hsym:=tsym(trecorddef(p1.resulttype.def).symtable.search(pattern));
  1633. if assigned(hsym) and
  1634. (hsym.typ=varsym) then
  1635. p1:=csubscriptnode.create(tvarsym(hsym),p1)
  1636. else
  1637. begin
  1638. Message1(sym_e_illegal_field,pattern);
  1639. p1.destroy;
  1640. p1:=cerrornode.create;
  1641. end;
  1642. consume(_ID);
  1643. end;
  1644. variantdef:
  1645. begin
  1646. end;
  1647. classrefdef:
  1648. begin
  1649. classh:=tobjectdef(tclassrefdef(p1.resulttype.def).pointertype.def);
  1650. hsym:=nil;
  1651. while assigned(classh) do
  1652. begin
  1653. hsym:=tsym(classh.symtable.search(pattern));
  1654. if assigned(hsym) and
  1655. tstoredsym(hsym).is_visible_for_proc(aktprocdef) then
  1656. break;
  1657. classh:=classh.childof;
  1658. end;
  1659. if hsym=nil then
  1660. begin
  1661. Message1(sym_e_id_no_member,pattern);
  1662. p1.destroy;
  1663. p1:=cerrornode.create;
  1664. { try to clean up }
  1665. consume(_ID);
  1666. end
  1667. else
  1668. begin
  1669. consume(_ID);
  1670. do_member_read(getaddr,hsym,p1,again);
  1671. end;
  1672. end;
  1673. objectdef:
  1674. begin
  1675. classh:=tobjectdef(p1.resulttype.def);
  1676. hsym:=nil;
  1677. store_static:=allow_only_static;
  1678. allow_only_static:=false;
  1679. while assigned(classh) do
  1680. begin
  1681. hsym:=tsym(classh.symtable.search(pattern));
  1682. if assigned(hsym) and
  1683. tstoredsym(hsym).is_visible_for_proc(aktprocdef) then
  1684. break;
  1685. classh:=classh.childof;
  1686. end;
  1687. allow_only_static:=store_static;
  1688. if hsym=nil then
  1689. begin
  1690. Message1(sym_e_id_no_member,pattern);
  1691. p1.destroy;
  1692. p1:=cerrornode.create;
  1693. { try to clean up }
  1694. consume(_ID);
  1695. end
  1696. else
  1697. begin
  1698. consume(_ID);
  1699. do_member_read(getaddr,hsym,p1,again);
  1700. end;
  1701. end;
  1702. pointerdef:
  1703. begin
  1704. Message(cg_e_invalid_qualifier);
  1705. if tpointerdef(p1.resulttype.def).pointertype.def.deftype in [recorddef,objectdef,classrefdef] then
  1706. Message(parser_h_maybe_deref_caret_missing);
  1707. end;
  1708. else
  1709. begin
  1710. Message(cg_e_invalid_qualifier);
  1711. p1.destroy;
  1712. p1:=cerrornode.create;
  1713. consume(_ID);
  1714. end;
  1715. end;
  1716. end;
  1717. else
  1718. begin
  1719. { is this a procedure variable ? }
  1720. if assigned(p1.resulttype.def) then
  1721. begin
  1722. if (p1.resulttype.def.deftype=procvardef) then
  1723. begin
  1724. if assigned(getprocvardef) and
  1725. is_equal(p1.resulttype.def,getprocvardef) then
  1726. again:=false
  1727. else
  1728. if (token=_LKLAMMER) or
  1729. ((tprocvardef(p1.resulttype.def).para.empty) and
  1730. (not((token in [_ASSIGNMENT,_UNEQUAL,_EQUAL]))) and
  1731. (not afterassignment) and
  1732. (not in_args)) then
  1733. begin
  1734. { do this in a strange way }
  1735. { it's not a clean solution }
  1736. p2:=p1;
  1737. p1:=ccallnode.create(nil,nil,nil,nil);
  1738. tcallnode(p1).set_procvar(p2);
  1739. if token=_LKLAMMER then
  1740. begin
  1741. consume(_LKLAMMER);
  1742. tcallnode(p1).left:=parse_paras(false,false);
  1743. consume(_RKLAMMER);
  1744. end;
  1745. { proc():= is never possible }
  1746. if token=_ASSIGNMENT then
  1747. begin
  1748. Message(cg_e_illegal_expression);
  1749. p1:=cerrornode.create;
  1750. again:=false;
  1751. end;
  1752. end
  1753. else
  1754. again:=false;
  1755. end
  1756. else
  1757. again:=false;
  1758. end
  1759. else
  1760. again:=false;
  1761. end;
  1762. end;
  1763. end; { while again }
  1764. end;
  1765. {---------------------------------------------
  1766. Factor (Main)
  1767. ---------------------------------------------}
  1768. var
  1769. l : longint;
  1770. card : cardinal;
  1771. ic : TConstExprInt;
  1772. oldp1,
  1773. p1 : tnode;
  1774. code : integer;
  1775. again : boolean;
  1776. sym : tsym;
  1777. classh : tobjectdef;
  1778. d : bestreal;
  1779. hs : string;
  1780. htype : ttype;
  1781. filepos : tfileposinfo;
  1782. {---------------------------------------------
  1783. Helpers
  1784. ---------------------------------------------}
  1785. procedure check_tokenpos;
  1786. begin
  1787. if (p1<>oldp1) then
  1788. begin
  1789. if assigned(p1) then
  1790. p1.set_tree_filepos(filepos);
  1791. oldp1:=p1;
  1792. filepos:=akttokenpos;
  1793. end;
  1794. end;
  1795. begin
  1796. oldp1:=nil;
  1797. p1:=nil;
  1798. filepos:=akttokenpos;
  1799. again:=false;
  1800. if token=_ID then
  1801. begin
  1802. factor_read_id(p1,again);
  1803. if again then
  1804. begin
  1805. check_tokenpos;
  1806. { handle post fix operators }
  1807. postfixoperators(p1,again);
  1808. end;
  1809. end
  1810. else
  1811. case token of
  1812. _SELF :
  1813. begin
  1814. again:=true;
  1815. consume(_SELF);
  1816. if not assigned(procinfo^._class) then
  1817. begin
  1818. p1:=cerrornode.create;
  1819. again:=false;
  1820. Message(parser_e_self_not_in_method);
  1821. end
  1822. else
  1823. begin
  1824. if (po_classmethod in aktprocdef.procoptions) then
  1825. begin
  1826. { self in class methods is a class reference type }
  1827. htype.setdef(procinfo^._class);
  1828. p1:=cselfnode.create(tobjectdef(tclassrefdef.create(htype)));
  1829. end
  1830. else
  1831. p1:=cselfnode.create(procinfo^._class);
  1832. postfixoperators(p1,again);
  1833. end;
  1834. end;
  1835. _INHERITED :
  1836. begin
  1837. again:=true;
  1838. consume(_INHERITED);
  1839. if assigned(procinfo^._class) then
  1840. begin
  1841. { if inherited; only then we need the method with
  1842. the same name }
  1843. if token=_SEMICOLON then
  1844. begin
  1845. hs:=aktprocsym.name;
  1846. auto_inherited:=true
  1847. end
  1848. else
  1849. begin
  1850. hs:=pattern;
  1851. consume(_ID);
  1852. auto_inherited:=false;
  1853. end;
  1854. classh:=procinfo^._class.childof;
  1855. while assigned(classh) do
  1856. begin
  1857. sym:=tsym(tobjectdef(classh).symtable.search(hs));
  1858. if assigned(sym) and
  1859. tstoredsym(sym).is_visible_for_proc(aktprocdef) then
  1860. begin
  1861. if sym.typ=procsym then
  1862. begin
  1863. htype.setdef(classh);
  1864. p1:=ctypenode.create(htype);
  1865. end;
  1866. do_member_read(false,sym,p1,again);
  1867. break;
  1868. end;
  1869. classh:=classh.childof;
  1870. end;
  1871. if classh=nil then
  1872. begin
  1873. Message1(sym_e_id_no_member,hs);
  1874. again:=false;
  1875. p1:=cerrornode.create;
  1876. end;
  1877. { turn auto inheriting off }
  1878. auto_inherited:=false;
  1879. end
  1880. else
  1881. begin
  1882. Message(parser_e_generic_methods_only_in_methods);
  1883. again:=false;
  1884. p1:=cerrornode.create;
  1885. end;
  1886. postfixoperators(p1,again);
  1887. end;
  1888. _INTCONST :
  1889. begin
  1890. { try cardinal first }
  1891. val(pattern,card,code);
  1892. if code<>0 then
  1893. begin
  1894. { then longint }
  1895. valint(pattern,l,code);
  1896. if code <> 0 then
  1897. begin
  1898. { then int64 }
  1899. val(pattern,ic,code);
  1900. if code<>0 then
  1901. begin
  1902. {finally float }
  1903. val(pattern,d,code);
  1904. if code<>0 then
  1905. begin
  1906. Message(cg_e_invalid_integer);
  1907. consume(_INTCONST);
  1908. l:=1;
  1909. p1:=cordconstnode.create(l,s32bittype);
  1910. end
  1911. else
  1912. begin
  1913. consume(_INTCONST);
  1914. p1:=crealconstnode.create(d,pbestrealtype^);
  1915. end;
  1916. end
  1917. else
  1918. begin
  1919. consume(_INTCONST);
  1920. p1:=cordconstnode.create(ic,cs64bittype);
  1921. end
  1922. end
  1923. else
  1924. begin
  1925. consume(_INTCONST);
  1926. p1:=cordconstnode.create(l,s32bittype)
  1927. end
  1928. end
  1929. else
  1930. begin
  1931. consume(_INTCONST);
  1932. { check whether the value isn't in the longint range as well }
  1933. { (longint is easier to perform calculations with) (JM) }
  1934. if card <= $7fffffff then
  1935. { no sign extension necessary, so not longint typecast (JM) }
  1936. p1:=cordconstnode.create(card,s32bittype)
  1937. else
  1938. p1:=cordconstnode.create(card,u32bittype)
  1939. end;
  1940. end;
  1941. _REALNUMBER :
  1942. begin
  1943. val(pattern,d,code);
  1944. if code<>0 then
  1945. begin
  1946. Message(parser_e_error_in_real);
  1947. d:=1.0;
  1948. end;
  1949. consume(_REALNUMBER);
  1950. p1:=crealconstnode.create(d,pbestrealtype^);
  1951. end;
  1952. _STRING :
  1953. begin
  1954. string_dec(htype);
  1955. { STRING can be also a type cast }
  1956. if token=_LKLAMMER then
  1957. begin
  1958. consume(_LKLAMMER);
  1959. p1:=comp_expr(true);
  1960. consume(_RKLAMMER);
  1961. p1:=ctypeconvnode.create(p1,htype);
  1962. include(p1.flags,nf_explizit);
  1963. { handle postfix operators here e.g. string(a)[10] }
  1964. again:=true;
  1965. postfixoperators(p1,again);
  1966. end
  1967. else
  1968. p1:=ctypenode.create(htype);
  1969. end;
  1970. _FILE :
  1971. begin
  1972. htype:=cfiletype;
  1973. consume(_FILE);
  1974. { FILE can be also a type cast }
  1975. if token=_LKLAMMER then
  1976. begin
  1977. consume(_LKLAMMER);
  1978. p1:=comp_expr(true);
  1979. consume(_RKLAMMER);
  1980. p1:=ctypeconvnode.create(p1,htype);
  1981. include(p1.flags,nf_explizit);
  1982. { handle postfix operators here e.g. string(a)[10] }
  1983. again:=true;
  1984. postfixoperators(p1,again);
  1985. end
  1986. else
  1987. begin
  1988. p1:=ctypenode.create(htype);
  1989. end;
  1990. end;
  1991. _CSTRING :
  1992. begin
  1993. p1:=cstringconstnode.createstr(pattern,st_default);
  1994. consume(_CSTRING);
  1995. end;
  1996. _CCHAR :
  1997. begin
  1998. p1:=cordconstnode.create(ord(pattern[1]),cchartype);
  1999. consume(_CCHAR);
  2000. end;
  2001. _CWSTRING:
  2002. begin
  2003. p1:=cstringconstnode.createwstr(patternw);
  2004. consume(_CWSTRING);
  2005. end;
  2006. _CWCHAR:
  2007. begin
  2008. p1:=cordconstnode.create(ord(getcharwidestring(patternw,0)),cwidechartype);
  2009. consume(_CWCHAR);
  2010. end;
  2011. _KLAMMERAFFE :
  2012. begin
  2013. consume(_KLAMMERAFFE);
  2014. got_addrn:=true;
  2015. { support both @<x> and @(<x>) }
  2016. if token=_LKLAMMER then
  2017. begin
  2018. consume(_LKLAMMER);
  2019. p1:=factor(true);
  2020. consume(_RKLAMMER);
  2021. if token in [_CARET,_POINT,_LECKKLAMMER] then
  2022. begin
  2023. again:=true;
  2024. postfixoperators(p1,again);
  2025. end;
  2026. end
  2027. else
  2028. p1:=factor(true);
  2029. got_addrn:=false;
  2030. p1:=caddrnode.create(p1);
  2031. if assigned(getprocvardef) then
  2032. taddrnode(p1).getprocvardef:=getprocvardef;
  2033. end;
  2034. _LKLAMMER :
  2035. begin
  2036. consume(_LKLAMMER);
  2037. p1:=comp_expr(true);
  2038. consume(_RKLAMMER);
  2039. { it's not a good solution }
  2040. { but (a+b)^ makes some problems }
  2041. if token in [_CARET,_POINT,_LECKKLAMMER] then
  2042. begin
  2043. again:=true;
  2044. postfixoperators(p1,again);
  2045. end;
  2046. end;
  2047. _LECKKLAMMER :
  2048. begin
  2049. consume(_LECKKLAMMER);
  2050. p1:=factor_read_set;
  2051. consume(_RECKKLAMMER);
  2052. end;
  2053. _PLUS :
  2054. begin
  2055. consume(_PLUS);
  2056. p1:=factor(false);
  2057. end;
  2058. _MINUS :
  2059. begin
  2060. consume(_MINUS);
  2061. p1:=sub_expr(oppower,false);
  2062. p1:=cunaryminusnode.create(p1);
  2063. end;
  2064. _OP_NOT :
  2065. begin
  2066. consume(_OP_NOT);
  2067. p1:=factor(false);
  2068. p1:=cnotnode.create(p1);
  2069. end;
  2070. _TRUE :
  2071. begin
  2072. consume(_TRUE);
  2073. p1:=cordconstnode.create(1,booltype);
  2074. end;
  2075. _FALSE :
  2076. begin
  2077. consume(_FALSE);
  2078. p1:=cordconstnode.create(0,booltype);
  2079. end;
  2080. _NIL :
  2081. begin
  2082. consume(_NIL);
  2083. p1:=cnilnode.create;
  2084. end;
  2085. else
  2086. begin
  2087. p1:=cerrornode.create;
  2088. consume(token);
  2089. Message(cg_e_illegal_expression);
  2090. end;
  2091. end;
  2092. { generate error node if no node is created }
  2093. if not assigned(p1) then
  2094. begin
  2095. {$ifdef EXTDEBUG}
  2096. Comment(V_Warning,'factor: p1=nil');
  2097. {$endif}
  2098. p1:=cerrornode.create;
  2099. end;
  2100. { get the resulttype for the node }
  2101. if (not assigned(p1.resulttype.def)) then
  2102. do_resulttypepass(p1);
  2103. { tp7 procvar handling, but not if the next token
  2104. will be a := }
  2105. if (m_tp_procvar in aktmodeswitches) and
  2106. (token<>_ASSIGNMENT) then
  2107. check_tp_procvar(p1);
  2108. factor:=p1;
  2109. check_tokenpos;
  2110. end;
  2111. {$ifdef fpc}
  2112. {$maxfpuregisters default}
  2113. {$endif fpc}
  2114. {****************************************************************************
  2115. Sub_Expr
  2116. ****************************************************************************}
  2117. const
  2118. { Warning these stay be ordered !! }
  2119. operator_levels:array[Toperator_precedence] of set of Ttoken=
  2120. ([_LT,_LTE,_GT,_GTE,_EQUAL,_UNEQUAL,_OP_IN,_OP_IS],
  2121. [_PLUS,_MINUS,_OP_OR,_OP_XOR],
  2122. [_CARET,_SYMDIF,_STARSTAR,_STAR,_SLASH,
  2123. _OP_AS,_OP_AND,_OP_DIV,_OP_MOD,_OP_SHL,_OP_SHR],
  2124. [_STARSTAR] );
  2125. function sub_expr(pred_level:Toperator_precedence;accept_equal : boolean):tnode;
  2126. {Reads a subexpression while the operators are of the current precedence
  2127. level, or any higher level. Replaces the old term, simpl_expr and
  2128. simpl2_expr.}
  2129. var
  2130. p1,p2 : tnode;
  2131. oldt : Ttoken;
  2132. filepos : tfileposinfo;
  2133. begin
  2134. if pred_level=highest_precedence then
  2135. p1:=factor(false)
  2136. else
  2137. p1:=sub_expr(succ(pred_level),true);
  2138. repeat
  2139. if (token in operator_levels[pred_level]) and
  2140. ((token<>_EQUAL) or accept_equal) then
  2141. begin
  2142. oldt:=token;
  2143. filepos:=akttokenpos;
  2144. consume(token);
  2145. if pred_level=highest_precedence then
  2146. p2:=factor(false)
  2147. else
  2148. p2:=sub_expr(succ(pred_level),true);
  2149. case oldt of
  2150. _PLUS :
  2151. p1:=caddnode.create(addn,p1,p2);
  2152. _MINUS :
  2153. p1:=caddnode.create(subn,p1,p2);
  2154. _STAR :
  2155. p1:=caddnode.create(muln,p1,p2);
  2156. _SLASH :
  2157. p1:=caddnode.create(slashn,p1,p2);
  2158. _EQUAL :
  2159. p1:=caddnode.create(equaln,p1,p2);
  2160. _GT :
  2161. p1:=caddnode.create(gtn,p1,p2);
  2162. _LT :
  2163. p1:=caddnode.create(ltn,p1,p2);
  2164. _GTE :
  2165. p1:=caddnode.create(gten,p1,p2);
  2166. _LTE :
  2167. p1:=caddnode.create(lten,p1,p2);
  2168. _SYMDIF :
  2169. p1:=caddnode.create(symdifn,p1,p2);
  2170. _STARSTAR :
  2171. p1:=caddnode.create(starstarn,p1,p2);
  2172. _OP_AS :
  2173. p1:=casnode.create(p1,p2);
  2174. _OP_IN :
  2175. p1:=cinnode.create(p1,p2);
  2176. _OP_IS :
  2177. p1:=cisnode.create(p1,p2);
  2178. _OP_OR :
  2179. p1:=caddnode.create(orn,p1,p2);
  2180. _OP_AND :
  2181. p1:=caddnode.create(andn,p1,p2);
  2182. _OP_DIV :
  2183. p1:=cmoddivnode.create(divn,p1,p2);
  2184. _OP_NOT :
  2185. p1:=cnotnode.create(p1);
  2186. _OP_MOD :
  2187. p1:=cmoddivnode.create(modn,p1,p2);
  2188. _OP_SHL :
  2189. p1:=cshlshrnode.create(shln,p1,p2);
  2190. _OP_SHR :
  2191. p1:=cshlshrnode.create(shrn,p1,p2);
  2192. _OP_XOR :
  2193. p1:=caddnode.create(xorn,p1,p2);
  2194. _ASSIGNMENT :
  2195. p1:=cassignmentnode.create(p1,p2);
  2196. _CARET :
  2197. p1:=caddnode.create(caretn,p1,p2);
  2198. _UNEQUAL :
  2199. p1:=caddnode.create(unequaln,p1,p2);
  2200. end;
  2201. p1.set_tree_filepos(filepos);
  2202. end
  2203. else
  2204. break;
  2205. until false;
  2206. sub_expr:=p1;
  2207. end;
  2208. function comp_expr(accept_equal : boolean):tnode;
  2209. var
  2210. oldafterassignment : boolean;
  2211. p1 : tnode;
  2212. begin
  2213. oldafterassignment:=afterassignment;
  2214. afterassignment:=true;
  2215. p1:=sub_expr(opcompare,accept_equal);
  2216. { get the resulttype for this expression }
  2217. if not assigned(p1.resulttype.def) then
  2218. do_resulttypepass(p1);
  2219. afterassignment:=oldafterassignment;
  2220. comp_expr:=p1;
  2221. end;
  2222. function expr : tnode;
  2223. var
  2224. p1,p2 : tnode;
  2225. oldafterassignment : boolean;
  2226. oldp1 : tnode;
  2227. filepos : tfileposinfo;
  2228. begin
  2229. oldafterassignment:=afterassignment;
  2230. p1:=sub_expr(opcompare,true);
  2231. { get the resulttype for this expression }
  2232. if not assigned(p1.resulttype.def) then
  2233. do_resulttypepass(p1);
  2234. filepos:=akttokenpos;
  2235. if (m_tp_procvar in aktmodeswitches) and
  2236. (token<>_ASSIGNMENT) then
  2237. check_tp_procvar(p1);
  2238. if token in [_ASSIGNMENT,_PLUSASN,_MINUSASN,_STARASN,_SLASHASN] then
  2239. afterassignment:=true;
  2240. oldp1:=p1;
  2241. case token of
  2242. _POINTPOINT :
  2243. begin
  2244. consume(_POINTPOINT);
  2245. p2:=sub_expr(opcompare,true);
  2246. p1:=crangenode.create(p1,p2);
  2247. end;
  2248. _ASSIGNMENT :
  2249. begin
  2250. consume(_ASSIGNMENT);
  2251. if (p1.resulttype.def.deftype=procvardef) then
  2252. getprocvardef:=tprocvardef(p1.resulttype.def);
  2253. p2:=sub_expr(opcompare,true);
  2254. if assigned(getprocvardef) then
  2255. handle_procvar(getprocvardef,p2,true);
  2256. getprocvardef:=nil;
  2257. p1:=cassignmentnode.create(p1,p2);
  2258. end;
  2259. _PLUSASN :
  2260. begin
  2261. consume(_PLUSASN);
  2262. p2:=sub_expr(opcompare,true);
  2263. p1:=cassignmentnode.create(p1,caddnode.create(addn,p1.getcopy,p2));
  2264. end;
  2265. _MINUSASN :
  2266. begin
  2267. consume(_MINUSASN);
  2268. p2:=sub_expr(opcompare,true);
  2269. p1:=cassignmentnode.create(p1,caddnode.create(subn,p1.getcopy,p2));
  2270. end;
  2271. _STARASN :
  2272. begin
  2273. consume(_STARASN );
  2274. p2:=sub_expr(opcompare,true);
  2275. p1:=cassignmentnode.create(p1,caddnode.create(muln,p1.getcopy,p2));
  2276. end;
  2277. _SLASHASN :
  2278. begin
  2279. consume(_SLASHASN );
  2280. p2:=sub_expr(opcompare,true);
  2281. p1:=cassignmentnode.create(p1,caddnode.create(slashn,p1.getcopy,p2));
  2282. end;
  2283. end;
  2284. { get the resulttype for this expression }
  2285. if not assigned(p1.resulttype.def) then
  2286. do_resulttypepass(p1);
  2287. afterassignment:=oldafterassignment;
  2288. if p1<>oldp1 then
  2289. p1.set_tree_filepos(filepos);
  2290. expr:=p1;
  2291. end;
  2292. {$ifdef int64funcresok}
  2293. function get_intconst:TConstExprInt;
  2294. {$else int64funcresok}
  2295. function get_intconst:longint;
  2296. {$endif int64funcresok}
  2297. {Reads an expression, tries to evalute it and check if it is an integer
  2298. constant. Then the constant is returned.}
  2299. var
  2300. p:tnode;
  2301. begin
  2302. p:=comp_expr(true);
  2303. if not codegenerror then
  2304. begin
  2305. if (p.nodetype<>ordconstn) or
  2306. not(is_integer(p.resulttype.def)) then
  2307. Message(cg_e_illegal_expression)
  2308. else
  2309. get_intconst:=tordconstnode(p).value;
  2310. end;
  2311. p.free;
  2312. end;
  2313. function get_stringconst:string;
  2314. {Reads an expression, tries to evaluate it and checks if it is a string
  2315. constant. Then the constant is returned.}
  2316. var
  2317. p:tnode;
  2318. begin
  2319. get_stringconst:='';
  2320. p:=comp_expr(true);
  2321. if p.nodetype<>stringconstn then
  2322. begin
  2323. if (p.nodetype=ordconstn) and is_char(p.resulttype.def) then
  2324. get_stringconst:=char(tordconstnode(p).value)
  2325. else
  2326. Message(cg_e_illegal_expression);
  2327. end
  2328. else
  2329. get_stringconst:=strpas(tstringconstnode(p).value_str);
  2330. p.free;
  2331. end;
  2332. end.
  2333. {
  2334. $Log$
  2335. Revision 1.56 2002-01-29 21:25:22 peter
  2336. * more checks for private and protected
  2337. Revision 1.55 2002/01/24 18:25:49 peter
  2338. * implicit result variable generation for assembler routines
  2339. * removed m_tp modeswitch, use m_tp7 or not(m_fpc) instead
  2340. Revision 1.54 2002/01/06 21:47:32 peter
  2341. * removed getprocvar, use only getprocvardef
  2342. Revision 1.53 2001/12/31 16:59:42 peter
  2343. * protected/private symbols parsing fixed
  2344. Revision 1.52 2001/12/06 17:57:36 florian
  2345. + parasym to tparaitem added
  2346. Revision 1.51 2001/11/14 01:12:44 florian
  2347. * variant paramter passing and functions results fixed
  2348. Revision 1.50 2001/11/02 23:16:51 peter
  2349. * removed obsolete chainprocsym and test_procsym code
  2350. Revision 1.49 2001/11/02 22:58:05 peter
  2351. * procsym definition rewrite
  2352. Revision 1.48 2001/10/28 17:22:25 peter
  2353. * allow assignment of overloaded procedures to procvars when we know
  2354. which procedure to take
  2355. Revision 1.47 2001/10/24 11:51:39 marco
  2356. * Make new/dispose system functions instead of keywords
  2357. Revision 1.46 2001/10/21 13:10:51 peter
  2358. * better support for indexed properties
  2359. Revision 1.45 2001/10/21 12:33:07 peter
  2360. * array access for properties added
  2361. Revision 1.44 2001/10/20 19:28:39 peter
  2362. * interface 2 guid support
  2363. * guid constants support
  2364. Revision 1.43 2001/10/18 16:30:38 jonas
  2365. * property parameters are now fully parsed by the firstcall code to
  2366. check for the correct amount and types (merged)
  2367. Revision 1.42 2001/09/02 21:18:28 peter
  2368. * split constsym.value in valueord,valueordptr,valueptr. The valueordptr
  2369. is used for holding target platform pointer values. As those can be
  2370. bigger than the source platform.
  2371. Revision 1.41 2001/08/26 13:36:45 florian
  2372. * some cg reorganisation
  2373. * some PPC updates
  2374. Revision 1.40 2001/08/22 21:16:21 florian
  2375. * some interfaces related problems regarding
  2376. mapping of interface implementions fixed
  2377. Revision 1.39 2001/08/06 21:40:47 peter
  2378. * funcret moved from tprocinfo to tprocdef
  2379. Revision 1.38 2001/07/09 21:15:41 peter
  2380. * Length made internal
  2381. * Add array support for Length
  2382. Revision 1.37 2001/06/29 14:16:57 jonas
  2383. * fixed inconsistent handling of procvars in FPC mode (sometimes @ was
  2384. required to assign the address of a procedure to a procvar, sometimes
  2385. not. Now it is always required) (merged)
  2386. Revision 1.36 2001/06/04 18:16:42 peter
  2387. * fixed tp procvar support in parameters of a called procvar
  2388. * typenode cleanup, no special handling needed anymore for bt_type
  2389. Revision 1.35 2001/06/04 11:45:35 peter
  2390. * parse const after .. using bt_const block to allow expressions, this
  2391. is Delphi compatible
  2392. Revision 1.34 2001/05/19 21:15:53 peter
  2393. * allow typenodes for typeinfo and typeof
  2394. * tp procvar fixes for properties
  2395. Revision 1.33 2001/05/19 12:23:59 peter
  2396. * fixed crash with auto dereferencing
  2397. Revision 1.32 2001/05/09 19:52:51 peter
  2398. * removed unused allow_type
  2399. Revision 1.31 2001/05/04 15:52:03 florian
  2400. * some Delphi incompatibilities fixed:
  2401. - out, dispose and new can be used as idenfiers now
  2402. - const p = apointerype(nil); is supported now
  2403. + support for const p = apointertype(pointer(1234)); added
  2404. Revision 1.30 2001/04/14 14:07:10 peter
  2405. * moved more code from pass_1 to det_resulttype
  2406. Revision 1.29 2001/04/13 23:50:24 peter
  2407. * fpc mode now requires @ also when left of assignment is an procvardef
  2408. Revision 1.28 2001/04/13 01:22:12 peter
  2409. * symtable change to classes
  2410. * range check generation and errors fixed, make cycle DEBUG=1 works
  2411. * memory leaks fixed
  2412. Revision 1.27 2001/04/04 22:43:52 peter
  2413. * remove unnecessary calls to firstpass
  2414. Revision 1.26 2001/04/02 21:20:33 peter
  2415. * resulttype rewrite
  2416. Revision 1.25 2001/03/11 22:58:50 peter
  2417. * getsym redesign, removed the globals srsym,srsymtable
  2418. Revision 1.24 2000/12/25 00:07:27 peter
  2419. + new tlinkedlist class (merge of old tstringqueue,tcontainer and
  2420. tlinkedlist objects)
  2421. Revision 1.23 2000/12/19 20:36:03 peter
  2422. * cardinal const expr fix from jonas
  2423. Revision 1.22 2000/12/17 14:00:18 peter
  2424. * fixed static variables
  2425. Revision 1.21 2000/12/15 13:26:01 jonas
  2426. * only return int64's from functions if it int64funcresok is defined
  2427. + added int64funcresok define to options.pas
  2428. Revision 1.20 2000/12/15 12:13:52 michael
  2429. + Fix from Peter
  2430. Revision 1.19 2000/12/07 17:19:42 jonas
  2431. * new constant handling: from now on, hex constants >$7fffffff are
  2432. parsed as unsigned constants (otherwise, $80000000 got sign extended
  2433. and became $ffffffff80000000), all constants in the longint range
  2434. become longints, all constants >$7fffffff and <=cardinal($ffffffff)
  2435. are cardinals and the rest are int64's.
  2436. * added lots of longint typecast to prevent range check errors in the
  2437. compiler and rtl
  2438. * type casts of symbolic ordinal constants are now preserved
  2439. * fixed bug where the original resulttype.def wasn't restored correctly
  2440. after doing a 64bit rangecheck
  2441. Revision 1.18 2000/11/29 00:30:36 florian
  2442. * unused units removed from uses clause
  2443. * some changes for widestrings
  2444. Revision 1.17 2000/11/09 17:46:55 florian
  2445. * System.TypeInfo fixed
  2446. + System.Finalize implemented
  2447. + some new keywords for interface support added
  2448. Revision 1.16 2000/11/06 20:30:55 peter
  2449. * more fixes to get make cycle working
  2450. Revision 1.15 2000/11/04 14:25:20 florian
  2451. + merged Attila's changes for interfaces, not tested yet
  2452. Revision 1.14 2000/10/31 22:02:49 peter
  2453. * symtable splitted, no real code changes
  2454. Revision 1.13 2000/10/26 23:40:54 peter
  2455. * fixed crash with call from type decl which is not allowed (merged)
  2456. Revision 1.12 2000/10/21 18:16:12 florian
  2457. * a lot of changes:
  2458. - basic dyn. array support
  2459. - basic C++ support
  2460. - some work for interfaces done
  2461. ....
  2462. Revision 1.11 2000/10/14 10:14:51 peter
  2463. * moehrendorf oct 2000 rewrite
  2464. Revision 1.10 2000/10/01 19:48:25 peter
  2465. * lot of compile updates for cg11
  2466. Revision 1.9 2000/09/24 21:19:50 peter
  2467. * delphi compile fixes
  2468. Revision 1.8 2000/09/24 15:06:22 peter
  2469. * use defines.inc
  2470. Revision 1.7 2000/08/27 16:11:51 peter
  2471. * moved some util functions from globals,cobjects to cutils
  2472. * splitted files into finput,fmodule
  2473. Revision 1.6 2000/08/20 15:12:49 peter
  2474. * auto derefence mode for array pointer (merged)
  2475. Revision 1.5 2000/08/16 18:33:53 peter
  2476. * splitted namedobjectitem.next into indexnext and listnext so it
  2477. can be used in both lists
  2478. * don't allow "word = word" type definitions (merged)
  2479. Revision 1.4 2000/08/16 13:06:06 florian
  2480. + support of 64 bit integer constants
  2481. Revision 1.3 2000/08/04 22:00:52 peter
  2482. * merges from fixes
  2483. Revision 1.2 2000/07/13 11:32:44 michael
  2484. + removed logs
  2485. }