mattgodbolt / owlet-editor

A modern BBC BASIC editor inspired by the BBC Micro Bot (https://bbcmicrobot.com)
https://bbcmic.ro
54 stars 4 forks source link

Invalid operators #32

Open ojwb opened 4 years ago

ojwb commented 4 years ago

It would be helpful to people less familiar with BBC BASIC if invalid operators were highlighted in red like many other invalid cases are - especially for cases which are valid in other BASIC dialects and/or other languages. E.g.:

A=1:B=1:C=1:ONERRORREPORT:P." at line ";ERL;:G.ERL+10
A+=B
A-=B
A/=B
A*=B
A^=B
A=B<<C
A=B>>C
IFA==B:P.
IFA!=B:P.
IFA=>B:P.
IFA=<B:P.
IFA><B:P.
END

Some of these even work in later BBC BASIC versions.

(The "backwards" =>, etc are supported by e.g. Apple II BASIC)

mattgodbolt commented 4 years ago

Love it! We can even suggest a "quick fix" for some of these. Thanks for the suggestion!

ojwb commented 3 years ago

I noticed the list of operators actually currently includes << and >> (which are supported by BASIC V on RISC OS, but not BASIC II), and also == and != (which I don't think any BBC BASIC has). I guess just removing these probably makes no difference though, since they're composed of characters which are all valid operators.

Also it has { and } as @brackets (https://github.com/mattgodbolt/owlet-editor/blob/main/src/bbcbasic.js#L64), but I don't think they have any special meaning in BBC BASIC.