alan-if / alan

ALAN IF compilers and interpreters
https://alanif.se
Other
19 stars 3 forks source link

BUG: Block Comment Hide Source Lines from Parser #31

Closed tajmone closed 3 years ago

tajmone commented 3 years ago
ALAN 3.0beta8 build 2209 | Win 10 x64

It looks like block comments introduced another bug (this one might be quite serious, as it compromises correct source parsing).

Take the kitchen-ascii.alan sample adventure available at:

If you edit the source file, and remove the empty line between the end of the block comment and the Syntax 'look' statement:

//// Kitchen ASCII /////////////////////////////////////////////////////////////
A test adventure containing only ASCII characters.
Written by Tristano Ajmone, 2021, using ALAN 3.0beta8 build 2209.
Released into the public domain via the Unlicense: https://unlicense.org
////////////////////////////////////////////////////////////////////////////////
Syntax 'look' = 'look'.

Verb 'look'
  Does look.
End verb.

Compiling will issue the following warning:

line 8(6): 230 I : No syntax defined for this global verb, automatically used 'look'.

which of course is incorrect, since the Syntax for look is there, but it seems that the missing empty line after the closing block comment is hiding it from the parser.

thoni56 commented 3 years ago

Thanks for finding these corner cases ;-) This only happened if the source had CRLF line terminators.

tajmone commented 3 years ago

This only happened if the source had CRLF line terminators.

Somehow, I suspected this. I just can't believe how many problems software developers are still facing today because of this Jurassic-old problem of EOL differences. Sometimes, it seems like we're never going to get rid of it.