compiler parser bug

BlitzMax Forums/BlitzMax Programming/compiler parser bug

ziggy(Posted 2006) [#1]
Rem
Print "something"
don't tell me this is working weird  End Rem
Print "hello"


the word hello is never printed. the REM block is not closed becouse BlitzMax compiler treates the ' char inside multiline comments, as single line comments!!!!


Dreamora(Posted 2006) [#2]
The problem happens because End Rem is not at the beginning on its own line.


ziggy(Posted 2006) [#3]
Edit: I see multiline comments have to be at th starting of a line... weird... ok, I have to change the BLIde hilightingroutines...


Warren(Posted 2006) [#4]
Ideally the compiler should puke on that and complain that you didn't close your REM block though...


ziggy(Posted 2006) [#5]
definitively it SHOULD tell you you have an open REM block, exactly in the same way it tells you yo have any other block open (While / Wend, For / Next, ect...)


Fabian.(Posted 2006) [#6]
In BlitzMax you don't need to close rem-blocks, they're automatically closed at eof. If the compiler complained about this, it would extremely hurt downward compatibilities - the following is and should be in the future valid BMX-code:
Print "Line1"
Print "Line2"
Rem
Print "This is remed out"



ziggy(Posted 2006) [#7]
@Fabien: why? why should REM blocks work different from any other BitzMax Block?


Warren(Posted 2006) [#8]
That absolutely should throw an error, Fabian. Extending REM blocks across multiple files is all but useless except for the most bizarre edge cases imaginable.

I would think that would cause more errors than it fixes.

"Why isn't it compiling this code!? Oh ... the previously included file had an open REM block. There's an hour of my life down the drain."


Fabian.(Posted 2006) [#9]
why? why should REM blocks work different from any other BitzMax Block?
I know that it looks a bit inconsistently that rem differs from the other enclosing commands in BMX, however, comments should be treated differently since the characters they enclose are in contrast to the other block statements not compiled but are completely ignored. Therefore you can't interleave them:
Rem
Rem
EndRem
EndRem
doesn't work, so it makes no sense to expect from Rem/EndRem to work exactly the same like the others (While/EndWhile, Select/EndSelect....). So it wouldn't hurt any principles of BMX to let this behaviour as it is currently.

Why isn't it compiling this code!? Oh ... the previously included file had an open REM block. There's an hour of my life down the drain
Try this:

file1.bmx:
Strict
Framework brl.blitz

Include "file2.bmx"

WriteStdout "This gets printed, and that's the correct behaviour!~n"
file2.bmx:
Rem
All comment blocks are closed at eof (singleline as well as multiline)


ziggy(Posted 2006) [#10]
@Fabian: Of course you can't. that's not the point. I don't know of any other programing language that lets you leave opened comment blocks without throwing, at least, a warning.