{"_id":"@codincod/codemirror-lang-whitespace","_rev":"4-ca84ee4cbb06c5e01bb584e260621a7b","name":"@codincod/codemirror-lang-whitespace","dist-tags":{"latest":"0.4.0"},"versions":{"0.1.0":{"name":"@codincod/codemirror-lang-whitespace","version":"0.1.0","keywords":["assembly","code","codemirror","editor","esolang","whitespace"],"author":{"name":"CodinCod","email":"hello@codincod.com"},"license":"MIT","_id":"@codincod/codemirror-lang-whitespace@0.1.0","maintainers":[{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"}],"homepage":"https://codincod.com/","dist":{"shasum":"b7ee3473b34d22f47f35c2698d294a9f534c7dab","tarball":"https://registry.npmjs.org/@codincod/codemirror-lang-whitespace/-/codemirror-lang-whitespace-0.1.0.tgz","fileCount":12,"integrity":"sha512-VwomPh6IAw/t7OntVda/mhOlUr3A8XTdlNWMqUjK4ONec0DC2HaAoE06PiP7jty+WjllCRsK6kOvXlntaBgYgw==","signatures":[{"sig":"MEUCIDJyIn1hQ7MCwPt30a9SJrbBiDyVgYJxniSiOIwvmdiDAiEA5wpJD5acjfFIyMs8weIH1dzuHHY69LBwTA3it3u1UWM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":19884},"main":"dist/index.cjs","type":"module","types":"dist/index.d.ts","module":"dist/index.js","exports":{"import":"./dist/index.js","require":"./dist/index.cjs"},"gitHead":"c7bc95fb9c0053963c40c280969159cde982e1ec","scripts":{"gaps":"npm run build && node ../lezer-survey/src/cli.ts gaps --group top","test":"npm run build && node --test \"test/*.test.ts\"","build":"rm -rf dist && lezer-generator src/whitespace.grammar -o src/parser.js && cm-buildhelper src/whitespace.ts","corpus":"npm run build && node ../lezer-survey/src/cli.ts measure --group top","prepare":"npm run build","build-debug":"lezer-generator src/whitespace.grammar --names -o src/parser.js && cm-buildhelper src/whitespace.ts"},"_npmUser":{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"},"repository":{"url":"https://codeberg.org/reeven/codemirror-lang-whitespace","type":"git"},"_npmVersion":"11.6.2","description":"Whitespace assembly language support for the CodeMirror code editor","directories":{},"sideEffects":false,"_nodeVersion":"25.0.0","dependencies":{"@lezer/lr":"^1.0.0","@lezer/common":"^1.0.0","@lezer/highlight":"^1.0.0","@codemirror/language":"^6.0.0"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.6.0","@lezer/generator":"^1.7.0","@codemirror/state":"^6.7.1","@codemirror/buildhelper":"^1.0.2"},"_npmOperationalInternal":{"tmp":"tmp/codemirror-lang-whitespace_0.1.0_1786042879300_0.32221235913789004","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@codincod/codemirror-lang-whitespace","version":"0.2.0","keywords":["assembly","code","codemirror","editor","esolang","whitespace"],"author":{"name":"CodinCod","email":"hello@codincod.com"},"license":"MIT","_id":"@codincod/codemirror-lang-whitespace@0.2.0","maintainers":[{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"}],"homepage":"https://codincod.com/","dist":{"shasum":"a0692616d490cf35729424df80cf7a68fc7998cf","tarball":"https://registry.npmjs.org/@codincod/codemirror-lang-whitespace/-/codemirror-lang-whitespace-0.2.0.tgz","fileCount":12,"integrity":"sha512-3CaQpjHg8c+d9Cbso4ynyZl4dlQCkCggv0xSxk1EQUjeKFzo6b3rUaLMWd9DSzg+6Wk6DZIAQ3uS07htV1flCw==","signatures":[{"sig":"MEYCIQDABrbS0oUysp1hUB3ogRr8ape6qAA7FCo7dHo1OOdPHwIhAJtcXGufWdXkPtLJqFRB/esCZ1gTxSHae3/0vrwt9mky","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":28281},"main":"dist/index.cjs","type":"module","types":"dist/index.d.ts","module":"dist/index.js","exports":{"import":"./dist/index.js","require":"./dist/index.cjs"},"gitHead":"ec02a9c922acfccd2bb7088514d7ea0f310b0fed","scripts":{"gaps":"npm run build && node ../lezer-survey/src/cli.ts gaps --group top","test":"npm run build && node --test \"test/*.test.ts\"","build":"rm -rf dist && lezer-generator src/whitespace.grammar -o src/parser.js && cm-buildhelper src/whitespace.ts","corpus":"npm run build && node ../lezer-survey/src/cli.ts measure --group top","prepare":"npm run build","build-debug":"lezer-generator src/whitespace.grammar --names -o src/parser.js && cm-buildhelper src/whitespace.ts"},"_npmUser":{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"},"repository":{"url":"https://codeberg.org/reeven/codemirror-lang-whitespace","type":"git"},"_npmVersion":"11.6.2","description":"Whitespace assembly language support for the CodeMirror code editor","directories":{},"sideEffects":false,"_nodeVersion":"25.0.0","dependencies":{"@lezer/lr":"^1.0.0","@lezer/common":"^1.0.0","@lezer/highlight":"^1.0.0","@codemirror/language":"^6.0.0"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.6.0","@lezer/generator":"^1.7.0","@codemirror/state":"^6.7.1","@codemirror/buildhelper":"^1.0.2"},"_npmOperationalInternal":{"tmp":"tmp/codemirror-lang-whitespace_0.2.0_1786044348468_0.2280102015651908","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@codincod/codemirror-lang-whitespace","version":"0.3.0","keywords":["assembly","code","codemirror","editor","esolang","whitespace"],"author":{"name":"CodinCod","email":"hello@codincod.com"},"license":"MIT","_id":"@codincod/codemirror-lang-whitespace@0.3.0","maintainers":[{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"}],"homepage":"https://codincod.com/","dist":{"shasum":"eeedc2ef39f975fa1049032b3267d3a114458def","tarball":"https://registry.npmjs.org/@codincod/codemirror-lang-whitespace/-/codemirror-lang-whitespace-0.3.0.tgz","fileCount":12,"integrity":"sha512-K9wG8GVO81rFPFFAqTcKF+6BGbfh9Fsd9jf3ObE6QP/ygvXZOpcE4JFV6BGk2AO9p8413v79T5e44zwRmhS7jg==","signatures":[{"sig":"MEQCIDq2YJCeCnA0Db7Gvv3Xx+Y+mX3dFBpwOuI2kfyXf8YAAiBY47Nj6C1TjzC6zjGfNhpKwtNOn04nGqLTa3LrZxapdQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":29841},"main":"dist/index.cjs","type":"module","types":"dist/index.d.ts","module":"dist/index.js","exports":{"import":"./dist/index.js","require":"./dist/index.cjs"},"gitHead":"85e5f2b371183d7dc299edff2bd91706dd0c25c9","scripts":{"fuzz":"npm run build && node ../lezer-survey/src/cli.ts fuzz","gaps":"npm run build && node ../lezer-survey/src/cli.ts gaps --group top","test":"npm run build && node --test \"test/*.test.ts\"","build":"rm -rf dist && lezer-generator src/whitespace.grammar -o src/parser.js && cm-buildhelper src/whitespace.ts","measure":"npm run build && node ../lezer-survey/src/cli.ts measure --group top","prepare":"npm run build","build-debug":"lezer-generator src/whitespace.grammar --names -o src/parser.js && cm-buildhelper src/whitespace.ts"},"_npmUser":{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"},"repository":{"url":"https://codeberg.org/reeven/codemirror-lang-whitespace","type":"git"},"_npmVersion":"11.6.2","description":"Whitespace assembly language support for the CodeMirror code editor","directories":{},"sideEffects":false,"_nodeVersion":"25.0.0","dependencies":{"@lezer/lr":"^1.0.0","@lezer/highlight":"^1.0.0","@codemirror/language":"^6.0.0"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.6.0","@lezer/generator":"^1.7.0","@codemirror/state":"^6.7.1","@codemirror/buildhelper":"^1.0.2"},"_npmOperationalInternal":{"tmp":"tmp/codemirror-lang-whitespace_0.3.0_1786660213186_0.6362411374046082","host":"s3://npm-registry-packages-npm-production"}},"0.4.0":{"name":"@codincod/codemirror-lang-whitespace","version":"0.4.0","description":"Whitespace assembly language support for the CodeMirror code editor","keywords":["assembly","code","codemirror","editor","esolang","whitespace"],"author":{"name":"CodinCod","email":"hello@codincod.com"},"license":"MIT","type":"module","main":"dist/index.cjs","exports":{"import":"./dist/index.js","require":"./dist/index.cjs"},"module":"dist/index.js","types":"dist/index.d.ts","sideEffects":false,"scripts":{"build":"rm -rf dist && lezer-generator src/whitespace.grammar -o src/parser.js && cm-buildhelper src/whitespace.ts","build-debug":"lezer-generator src/whitespace.grammar --names -o src/parser.js && cm-buildhelper src/whitespace.ts","prepare":"npm run build","test":"npm run build && node --test \"test/*.test.ts\"","measure":"npm run build && node ../lezer-survey/src/cli.ts measure --group top","fuzz":"npm run build && node ../lezer-survey/src/cli.ts fuzz","gaps":"npm run build && node ../lezer-survey/src/cli.ts gaps --group top"},"dependencies":{"@codemirror/language":"^6.0.0","@lezer/highlight":"^1.0.0","@lezer/lr":"^1.0.0"},"devDependencies":{"@codemirror/buildhelper":"^1.0.2","@codemirror/state":"^6.7.1","@lezer/generator":"^1.7.0","typescript":"^5.6.0"},"homepage":"https://codincod.com/","repository":{"type":"git","url":"https://codeberg.org/reeven/codemirror-lang-whitespace"},"gitHead":"85e5f2b371183d7dc299edff2bd91706dd0c25c9","_id":"@codincod/codemirror-lang-whitespace@0.4.0","_nodeVersion":"25.0.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-3mZMiOoi3doTsSsrAPfFlYlvmjy4GidibvAqXu9tBZ9ntQ27c8NbNIVDfUS77RjwOFj2ky8jTYr3qXZ4RNj2CA==","shasum":"13702b235d399bfcb277f966f23f73bc713435f4","tarball":"https://registry.npmjs.org/@codincod/codemirror-lang-whitespace/-/codemirror-lang-whitespace-0.4.0.tgz","fileCount":12,"unpackedSize":29841,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDBH8FD5HicoLROsMLUfWv3mCwSbcb++cUjTwwnM4VlbwIgFEBBU0ZQfesi7Xj2ef9IL0fgigAhN955syvv1cRH4pM="}]},"_npmUser":{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"},"directories":{},"maintainers":[{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/codemirror-lang-whitespace_0.4.0_1786761173647_0.942143526163048"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-06T19:01:19.109Z","modified":"2026-08-15T02:32:53.984Z","0.1.0":"2026-08-06T19:01:19.438Z","0.2.0":"2026-08-06T19:25:48.613Z","0.3.0":"2026-08-13T22:30:13.324Z","0.4.0":"2026-08-15T02:32:53.801Z"},"author":{"name":"CodinCod","email":"hello@codincod.com"},"license":"MIT","homepage":"https://codincod.com/","keywords":["assembly","code","codemirror","editor","esolang","whitespace"],"repository":{"type":"git","url":"https://codeberg.org/reeven/codemirror-lang-whitespace"},"description":"Whitespace assembly language support for the CodeMirror code editor","maintainers":[{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"}],"readme":"# @codincod/codemirror-lang-whitespace\n\nThis package implements [Whitespace](https://esolangs.org/wiki/Whitespace)\nassembly language support for the [CodeMirror](https://codemirror.net/) code\neditor: a [Lezer](https://lezer.codemirror.net/) grammar and highlighting.\n\nWritten in part for [CodinCod](https://codincod.com/), a competitive coding\nplatform, where it colours the editor people solve puzzles in.\n\nThis code is released under an\n[MIT license](https://codeberg.org/reeven/codemirror-lang-whitespace/src/branch/master/LICENSE).\n\n## The assembly, not the language\n\nWhitespace is spaces, tabs and linefeeds, and every other character in the file\nis a comment. That is unreadable on purpose and unwritable in practice, so\nnobody writes it. They write mnemonics and assemble them, and what an editor is\never asked to show is the mnemonics:\n\n```\npush 0\n; Increment indefinitely.\n0:\n    push -1 ; Sentinel value so the printer knows when to stop.\n    copy 1\n    call 1\n    jump 0\n```\n\nA file of the real thing parses too, as nothing at all, which is what it looks\nlike.\n\n## Usage\n\n```javascript\nimport {EditorView, basicSetup} from \"codemirror\"\nimport {whitespace} from \"@codincod/codemirror-lang-whitespace\"\n\nconst view = new EditorView({\n  parent: document.body,\n  doc: `push \"Hello\"  ; pushed in reverse order\npush 11         ; how many characters\ncall 0\nexit\n\n0:\n  dup jumpz 1\n  exch prtc\n  push 1 sub\n  jump 0\n\n1:\n  pop ret\n`,\n  extensions: [basicSetup, whitespace()]\n})\n```\n\n## What it reads\n\nThe mnemonics were read off real programs rather than off a manual. On\nCodinCod's language-guessing pool, 9 snippets of Whitespace from Rosetta Code:\n\n| | Tagged | Colours | Busiest colour |\n| --- | --: | --: | --: |\n| this | 100.00% | 9 | 56.18% |\n| plain text, which is what it had | 0.00% | 0 | – |\n\nNothing is left uncoloured. A busiest colour of 56% is high and the language\nearns it: Whitespace is a stack machine, and `push` alone is a third of every\nprogram written for one.\n\nNine files is too few to conclude anything from, so 47 more were parsed, from\n[nebula](https://github.com/andrewarchi/nebula) and\n[vii5ard's assembler](https://github.com/vii5ard/whitespace). Doing that was\nworth it, because it turned out those two do not write the same language.\nTwo thirds of them failed on the first run.\n\nAll 56 parse clean now, which puts the true rate above 94.8% with 95%\nconfidence. Unlike the grid languages, this grammar can say no: prose, JSON and\na C file all come out as errors, so that figure is measuring something.\n\n## Three assemblers, three dialects\n\nThere is no one Whitespace assembler and no one spelling. The same instruction\nis `ochr` on Rosetta Code, `printc` in nebula and `print` in vii5ard's\nstandard library. What one of them defines and another does not is read here as\nan ordinary name rather than as a mistake, and the grammar takes the union:\n\n* Character literals. `push 'a'` and `push '\\n'` are how nebula writes what\n  Rosetta writes as `push 97`.\n* Local labels. A leading dot marks a label belonging to the routine above it,\n  which is a convention rather than a rule and appears both ways in one file.\n* Labels named after instructions. `call print` and `jz exit` name places, not\n  operations, and real programs are full of both.\n* Assembler directives: a constant given a name, a file pulled in, the word\n  that opens a macro, and the `$$` that stands for its body.\n* Three comment markers. `;`, `#` and `//` all begin one.\n\nThe last of those is where a reading had to be chosen rather than taken.\nnebula's scanner keeps `;` behind a mode flag: with it off, `;` separates two\ninstructions on a line, and `push 'E'; printc` is two pushes rather than a\npush and a comment. Nothing in the file says which mode assembled it. Rosetta\nCode, vii5ard and the pool all mean a comment, so a comment is what it reads,\nand the second instruction on a nebula line written that way is greyed. That\nis a miscolour and not an error, which is the right way round.\n\n## What took the work\n\n* **`jump 0` and `push 0` are the same character and not the same thing.** One\n  names a place in the program and the other is a value. A grammar that read\n  both as numbers would colour a program's control flow as arithmetic, so a\n  branch takes a label and everything else takes an operand, and the two land\n  on different inks. A label is written with its colon attached at the point it\n  is defined, which keeps `0:` one token and out of the way of the `0` in\n  `push 0`. What a branch names, though, is whatever the author typed, and\n  what they typed is often a word the assembler also uses for an instruction,\n  so every mnemonic is admitted in that one position and coloured as the label\n  it is there.\n\nA word no assembler here defines keeps the plain ink an ordinary name gets, so\na typo does not come out looking like a keyword.\n\n## Development\n\n```bash\nnpm install\nnpm test            # the parse specs and the colours\n```\n","readmeFilename":"README.md"}