Author Topic: Question about #Lookahead  (Read 1890 times)

0 Members and 1 Guest are viewing this topic.

Arnold

  • Hero Member
  • *****
  • Posts: 872
Question about #Lookahead
« on: February 18, 2015, 05:18:04 AM »
Hi Charles,

in examples\System there is a demo: MemLeakStrTest.o2bas which gives an error message. I do not know if this is expected? If I move function Replace above the line with sys i then the demo will work with or without #Lookahead.

I am not yet finished with modifying ruben2.o2bas to a bottom up arrangement. But I notice that there is a flow: Expression calls Term which calls Factor which calls Expression ... And there are many gosubs. In the moment I do not really look into the code, I only want to see the "No source" message.

Roland


Aurel

  • Guest
Re: Question about #Lookahead
« Reply #1 on: February 18, 2015, 07:59:39 AM »
Quote
I am not yet finished with modifying ruben2.o2bas to a bottom up arrangement. But I notice that there is a flow: Expression calls Term which calls Factor which calls Expression ... And there are many gosubs. In the moment I do not really look into the code, I only want to see the "No source" message.

i don't have problem with this example probably because i use old dll ???

Roland
you can try updated source from ruben topic  ;)
« Last Edit: February 18, 2015, 08:42:12 AM by Aurel »

Charles Pegge

  • Admin Support Member
  • *****
  • Posts: 4205
    • Oxygen Basic
Re: Question about #Lookahead
« Reply #2 on: February 18, 2015, 02:51:58 PM »
Hi Roland,

An interesting case! #lookahead confused String the type with String() the function.

Thanks for spotting it.

Oxygen Update
http://www.oxygenbasic.org/o2zips/Oxygen.zip

Aurel

  • Guest
Re: Question about #Lookahead
« Reply #3 on: February 18, 2015, 11:05:34 PM »
good to know is also if you declare all your user functions then you don't need lookahead ?

Arnold

  • Hero Member
  • *****
  • Posts: 872
Re: Question about #Lookahead
« Reply #4 on: February 19, 2015, 12:09:45 AM »
Hi Charles,

I was not sure if this is a special case which should be omitted. If I use the first commented statement: String s = Space(2500) then the demo will work with #Lookahead. It will also work if I use:
 String s
 s = String(2500,"A")

the numbers are then displayed not so fast as when filled with Space. I am curious about the filename? If I look at gxo2.exe with my TaskManager, there is a slight increase of memory usage after pressing the key, but I assume this is because of allocating memory for the string?

Roland

Aurel

  • Guest
Re: Question about #Lookahead
« Reply #5 on: February 19, 2015, 01:09:50 AM »
Arnold you must first declare
string s
then use s

anyway i have found that if /end if don't have proper error checking ???

Charles Pegge

  • Admin Support Member
  • *****
  • Posts: 4205
    • Oxygen Basic
Re: Question about #Lookahead
« Reply #6 on: February 19, 2015, 09:09:51 AM »
Yes, this code was originally written by Mike to expose a memory leak, when monitored with Task Manager.
« Last Edit: February 19, 2015, 09:22:15 AM by Charles Pegge »