pexpr.pas 97 KB

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