remy / txt2bas

ZX Spectrum BASIC conversion tooling (specific support for NextBASIC)
19 stars 0 forks source link

Lines started with semicolon or hash sign don't appear as comment #15

Closed paulossilva closed 4 years ago

paulossilva commented 4 years ago

On the online editor, lines started with ; or # should be treated as comments and coloured green.

remy commented 4 years ago

They are, what do you see? Screenshot_20200517-095409

remy commented 4 years ago

(excuse the massive screenshot 😆 )

paulossilva commented 4 years ago

I should have been more clear, sorry! I don't use line numbers in my NextBasic code since we have the #autoline directive, which is very helpful. So, without line numbers, comment lines aren't displayed as such in the online editor. As you haven't implemented the autoline directive (yet), please consider this issue as a feature request instead of a bug. Thanks!

Captura de Tela 2020-05-17 às 11 23 27

remy commented 4 years ago

Ah, I suspect you're not actually writing NextBASIC but using some extra layer of interpretation (maybe Boriel's ZX Basic?).

I just tried the following lines in NextBASIC both in the editor itself on the Next and in a text file and converting with .txt2bas on the Next, and they both error:

#autoline

PRINT "Hello world"
; this is a comment
Screenshot 2020-05-17 at 16 11 34

Edit: 2nd screenshot was supposed to be of .txt2bas but failed!

I'm not sure I plan to support outside of NextBASIC but it might be useful to get an idea of what you're actually doing (rather than me guessing as zxbasic)

paulossilva commented 4 years ago

No, I'm just using plain NextBasic. The #autoline directive is supported by the .txt2bas dot command bundled with the Next distribution. Try .txt2bas -h in the command line. This directive is not supported on the NextBasic editor by the way.

IMG_9406

IMG_9407

paulossilva commented 4 years ago

This directive is very helpful because, combined with procedures, it allows us to write NextBasic programs without the hassle of keeping track of line numbers (no need for GOTOs nor GOSUBs anymore). Check the NextInvaders game demo bundled with the latest distro, to have a glimpse of what I'm talking about.

remy commented 4 years ago

Oh wow, yeah - I see it in Nextinvaders now (and I had that in my test fixtures but hadn't spotted it at all!).

Right… I'll get that sorted. TIL ;-)

remy commented 4 years ago

Note for self: autoline seems to be a .txt2bas feature, the basicinvaders contains line numbers on each statement - checked with unpack + this unpacker:

<A8$sig
C$marker
C$issue
C$version
I$length
C$hType
S$hFileLength
S$autostart
S$hOffset
x
x104
C$checksum
n$lineNumber
s$len
A34

Specifically n$lineNumber is 10 (and peeking forward I see 20).

github-actions[bot] commented 4 years ago

:tada: This issue has been resolved in version 1.9.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

remy commented 4 years ago

This is also landing in zx.remysharp.com/bas now - thanks for the report (I picked this for my evening hack)