ZX BASIC language syntax for editing
.bas files in Sublime Text 3 code editor. It also supports regular Sinclair BASIC, and zmakebas listings.
ZX BASIC is an updated BASIC dialect which compiles to optimised Z80 machine code for the ZX Spectrum computer. The Sublime Text editor, like the ZX BASIC compiler, runs on Linux, Mac OS, and Windows.
This syntax highlighter does not exhaustively match all BASIC keywords, rather its focus is code clarity. Mariana colour scheme (pictured) is recommended over the default Monokai, since some highlights are invisible in Monokai.
- Line numbers, and labels which replace them
- Comment lines, comment blocks
- Strings including all ZX BASIC escaped characters and zmakebas escaped characters
- To avoid over-colouring, keywords are limited to conditionals and those controlling execution flow
- Sub and Function definitions and calls, although their calls are indistinguishable from array references (and strings without sigils) since the parser does not track objects
Hover the mouse pointer over a Sub/Function name to jump to the function definition, and to other mentions
- Variable types, numbers, separators, operator symbols, and compiler keywords
- Inline Z80 assembly language, via a dependency on https://github.com/mrcook/Z80Assembly
- Sublime Text -> Preferences -> Browse Packages... which will show you the User folder location
Z80Assembly.tmLanguage.sublime-syntaxto the User folder, ensuring your browser does not add .txt to the filenames
- View -> Syntax -> ZX BASIC!