0.0.2 • Published 6 months ago

pbasic-language-pack v0.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

PBasic Language Pack

A language pack for CodeMirror built using Lezer designed to provide insight into PBasic v2.5 code.

Implemented Language Features

AST Parsing

  • General language syntax
    • Arithmetic expressions
    • Expression grouping
    • Significant line endings
    • Line ending stand-ins via :
    • Pattern matching
    • Compile-time if/else, select NOTE: all compile-time information is currently shoved under the 'Preprocessor' token
  • VAR / CON declarations
    • general syntax
    • BIT / NIB / BYTE / WORD
    • <TYPE>(N) arrays
  • .LOWBYTE / .HIGHBYTE
  • AUXIO
  • BRANCH
  • BUTTON
  • COMPARE
  • CONFIGPIN
  • COUNT
  • DATA
    • named DATA
    • WORD-typed DATA
    • @address-ed DATA
    • reserved DATA
    • repeated DATA
    • expressions in DATA
  • DEBUG / SER / I2C / LCD, IN and OUT forms
    • simple DEBUG
    • all format specifiers
    • all special cases
  • DO ... LOOP
    • DO WHILE ...
    • DO UNTIL ...
    • DO ... LOOP WHILE
    • DO ... LOOP UNTIL
    • DO ... LOOP
  • DTMFOUT
  • END
  • EXIT
  • FOR ... NEXT
  • FREQOUT
  • GET
  • GOSUB
  • GOTO
  • HIGH
  • IF ... THEN ... ELSE
    • IF ... THEN
    • ELSEIF
    • ELSE
  • INPUT
  • IOTERM
  • LCDCMD
  • LOOKDOWN
  • LOOKUP
  • LOW
  • MAINIO
  • NAP
  • ON ... GOSUB/GOTO
  • OUTPUT
  • OWIN
  • OWOUT
  • PAUSE
  • POLL___
  • PULSIN
  • PULSOUT
  • PUT
  • PWM
  • RANDOM
  • RCTIME
  • READ
  • RETURN
  • REVERSE
  • RUN
  • SELECT ... CASE
    • Simple cases
    • Multiple cases
    • Comparison cases
    • Range cases
    • Else case
  • SHIFTIN
  • SHIFTOUT
  • SLEEP
  • STOP
  • STORE
  • TOGGLE
  • WRITE
  • XOUT

Todo: test it all :D

FAQ:

  • Use syntaxTree() to get the syntax tree from a editor state. THere is no obvious documentation which states this >:(
  • Many of the necessary types for interfacing with the library are private, so sometimes using type PrivType = Parameters<fnWithPrivType>[0]; will be necessary