Author Topic: more bugs..  (Read 899 times)

0 Members and 1 Guest are viewing this topic.

helloworld

  • Newbie
  • *
  • Posts: 14
more bugs..
« on: May 20, 2017, 06:18:46 AM »
Code below [oxygen.dll ver. A43] will not compile unless object's name is 'b' :D

Also, a situation like: <statement><colon><another statement> will not compile (i.e. "int a:int b"); have to leave at least one space inbetween (i.e. "int a :int b").

Code: [Select]
class aclass
method constructor : end method
method destructor : end method
end class

new aclass o
del o

Arnold

  • Sr. Member
  • ****
  • Posts: 426
Re: more bugs..
« Reply #1 on: May 20, 2017, 01:11:23 PM »
Quote
... will not compile (i.e. "int a:int b")

I myself would see this as a feature, not as a bug. I always set a space before and after the :. And I assume a: could be interpreted as a label under some circumstances. Nevertheless using win32 (win64 not tested) this will work on my system:

int a:int b
print a:print b

I get two messageboxes with 0.

I think the usual way to declare the variables would be: int a,b or: int a, int b. Another way would be: dim a as int, b as int.

Charles Pegge

  • Author
  • *****
  • Posts: 3224
    • Oxygen Basic
Re: more bugs..
« Reply #2 on: May 20, 2017, 02:25:48 PM »

I have been able to make the parser a little more discriminating. The spacing between the first word and a colon in the line, is used to determine whether the first word is a label, or another kind of symbol (such as a procedure or macro call).

As well as labels with attached colons, we also have NameSpace prefixes with double colons, for instance graphics::clear. Also Assembler segment override prefixes DS: [ebx+0x40]

So keeping your colon separators separate is generally a good idea :)

The del bug, and a few others I hesitate to mention are also fixed. Well done for diagnosing the problem!

Will post the update early tomorrow.

helloworld

  • Newbie
  • *
  • Posts: 14
Re: more bugs..
« Reply #3 on: May 24, 2017, 10:30:00 AM »
Will post the update early tomorrow.

However, now this does not work anymore:

Code: [Select]
class aclass
int a : int b
method constructor : end method
method destructor : end method
end class
new aclass o
del o

Whereas this does:

Code: [Select]
class aclass
method constructor : end method
method destructor : end method
end class
int a : int b
new aclass o
del o

Charles Pegge

  • Author
  • *****
  • Posts: 3224
    • Oxygen Basic
Re: more bugs..
« Reply #4 on: May 24, 2017, 06:37:43 PM »

helloworld,

The normal type syntax, used by classes, does not expect colon separators. The expected format is:

int a,b

Bit fields (an arcane C construct)  are accepted but not implemented:

int a : 4

But I will see if we can safely allow colon separators between members.

Charles Pegge

  • Author
  • *****
  • Posts: 3224
    • Oxygen Basic
Re: more bugs..
« Reply #5 on: June 02, 2017, 01:42:33 AM »

Okay, colon separators are now supported in type and class definitions. (May 31 2017)