A language pack for CodeMirror built using Lezer designed to provide insight into PBasic v2.5 code.
- 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 / CONdeclarations- general syntax
-
BIT/NIB/BYTE/WORD -
<TYPE>(N)arrays
-
.LOWBYTE/.HIGHBYTE -
AUXIO -
BRANCH -
BUTTON -
COMPARE -
CONFIGPIN -
COUNT -
DATA- named
DATA -
WORD-typedDATA -
@address-edDATA - reserved
DATA - repeated
DATA - expressions in
DATA
- named
-
DEBUG/SER/I2C/LCD,INandOUTforms- simple
DEBUG - all format specifiers
- all special cases
- simple
-
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