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

* command should last to end of line #37

Closed ojwb closed 3 weeks ago

ojwb commented 4 years ago

Currently the highlighter seems to switch back to BASIC if it sees a : in a * command:

*FX19:PRINT
mattgodbolt commented 4 years ago

This is going to be a fun one to do :) Context-sensitivity of symbols is a bit more fun in the (editor) tokeniser.

ojwb commented 4 years ago

It seems : doesn't end the content of a REM so perhaps * can work like that does?

mattgodbolt commented 4 years ago

That's not the problem, it's discriminating * in the middle of a line (3*2) vs one at the start or after a colon. REM is always REM (in theory). I think we'll need to make the editor tokeniser have a mode for "First part of a statement" vs the rest, to solve this.

ojwb commented 4 years ago

Oh I see - I was thinking you meant the context-sensitivity of :.

Yes, the Start flag in the token table seems the right thing for this - it even mentions *:

* - disables the tokeniser if encountered at the start of the statement.

mattgodbolt commented 3 years ago

With a new version of monaco, we should be able to do this: https://github.com/microsoft/monaco-editor/issues/2265

mattgodbolt commented 3 years ago

(the change to look for being merged is https://github.com/microsoft/vscode/commit/5cc0aa284968c66b0075ac3b89a70c2edb10b891 )

ojwb commented 3 years ago

Still present - here's a better reproducer (*.:0 is actually a useful command, at least if there's a disc in the drive) as a handy URL:

https://bbcmic.ro/#%7B%22v%22%3A1%2C%22program%22%3A%22*.%3A0%22%7D