codemirror-lang-snobol
v0.2.0
Published
SNOBOL4 language support for CodeMirror
Maintainers
Readme
codemirror-lang-snobol
SNOBOL4 syntax highlighting for CodeMirror 6, targeting the Snoflake dialect. It is case-insensitive and supports backtick-delimited multi-line literals, which in Snoflake carry inline JavaScript: those ranges are highlighted as JavaScript in place.
It is built on a Lezer grammar
(src/syntax.grammar). SNOBOL4 highlighting does not need a full parse — a
blank is at once the concatenation operator and the field separator, which no
context-free grammar untangles — so the grammar keeps the program a flat token
stream and pushes the one context-sensitive rule, column-one card
classification, into a small external tokenizer (src/tokens.js). The backtick
literal is handed to the JavaScript parser via parseMixed.
Install
npm install codemirror-lang-snobolThe CodeMirror packages are peer dependencies.
Use
import { basicSetup, EditorView } from "codemirror";
import { snobol } from "codemirror-lang-snobol";
new EditorView({
doc: " OUTPUT = 'HELLO, WORLD'\nEND\n",
extensions: [basicSetup, snobol()],
parent: document.body,
});License
BSD-2-Clause
