pexpr.pas 81 KB

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