Skip to content

Syntax highlighting

BASIC v2 and BPP+ language elements using TextMate grammar patterns.

What gets highlighted

Control flow keywords

end, for, next, gosub, goto, if, then, step, stop, return, to, on

for i=1 to 10 step 2
    print i
next i

if x=5 then print "found"
on n gosub 100,200,300

See BASIC v2 language reference.

Built-in functions

Math, string, and system functions:

a = abs(-5)
b$ = chr$(65)
c = peek(53280)

See BASIC v2 language reference.

Variables

Variable names with type suffixes ($ for string, % for integer):

a = 10
name$ = "hello"
count% = 100

See BASIC v2 language reference.

Numbers

Line numbers, decimal, hexadecimal, and binary formats:

10 a = 255
20 b = $ff
30 c = %11111111

Hexadecimal ($) and binary (%) are BPP+ extensions. See BASIC v2 Numbers.

Comments

rem (BASIC v2) and ; (BPP+) comments:

rem BASIC comment
; BPP+ comment

Both are removed during preprocessing. See BASIC v2 Comments and BPP+ Comments.

Strings and PETSCII tokens

Double-quoted strings with embedded PETSCII control characters:

print "{clr}{wht}Hello"
print "{10 space}Text"
print "{a-z}"

Tokens support basic codes ({clr}), repetition ({10 space}), and ranges ({a-z}). See Control characters reference.

Labels

Label definitions and references:

main:
    gosub init
    end

init:
    print "initialized"
    return

See BPP+ features.

Scopes

Hierarchical namespaces:

screen: {
    init:
        poke 53280,0
        return
}

gosub screen.init

See BPP+ features.

Includes

!include directives for source and data:

!include source "lib/screen.bpp"
!include data "charset.bin"

See BPP+ features.

Statement chaining

Backslash continuation character:

print "{clr}";\
print "{wht}Hello";\
return

See BPP+ features.

Extension symbols

See Extension symbols for MCI commands and Prof. Plum extensions.

Color schemes

Semantic token types adapt to your VS Code color theme:

  • Keywords
  • Functions
  • Operators
  • Numbers
  • Strings
  • Comments
  • Variables

Choose your preferred color theme in VS Code settings.


See also