{"_id":"@codincod/codemirror-lang-rebol","name":"@codincod/codemirror-lang-rebol","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@codincod/codemirror-lang-rebol","version":"0.1.0","description":"Rebol and Red language support for the CodeMirror code editor","keywords":["code","codemirror","editor","rebol","red"],"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/rebol.grammar -o src/parser.js && cm-buildhelper src/rebol.ts","build-debug":"lezer-generator src/rebol.grammar --names -o src/parser.js && cm-buildhelper src/rebol.ts","prepare":"npm run build","test":"npm run build && node --test \"test/*.test.ts\"","corpus":"npm run build && node ../lezer-survey/src/cli.ts measure --group parent","gaps":"npm run build && node ../lezer-survey/src/cli.ts gaps --group parent"},"dependencies":{"@codemirror/language":"^6.0.0","@lezer/common":"^1.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-rebol"},"gitHead":"28d3577c48f470484451cc657271bbccd00c0f28","_id":"@codincod/codemirror-lang-rebol@0.1.0","_nodeVersion":"25.0.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-JIzYkCkNhwXdpl6lFVxBguqZ0s70MoXU2u5nvh/xTAIzSHe6aM1DKNS7VoF2UOpg839+DeqxnmVIm/+xbwK62Q==","shasum":"5c4536e64d9fb015da3ed5e624eb97834ee804c0","tarball":"https://registry.npmjs.org/@codincod/codemirror-lang-rebol/-/codemirror-lang-rebol-0.1.0.tgz","fileCount":13,"unpackedSize":85176,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDjlMGT0OcUdIR7UfsBY5RVkG/gxU69SEApiJzJ/aDFsQIhAMDa+Rz4Cj6iy8PCsrs6AXlkWWPz6MryKOQi2hg9qbeC"}]},"_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-rebol_0.1.0_1786353197195_0.35266580647916523"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-10T09:13:17.008Z","0.1.0":"2026-08-10T09:13:17.365Z","modified":"2026-08-10T09:13:17.591Z"},"maintainers":[{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"}],"description":"Rebol and Red language support for the CodeMirror code editor","homepage":"https://codincod.com/","keywords":["code","codemirror","editor","rebol","red"],"repository":{"type":"git","url":"https://codeberg.org/reeven/codemirror-lang-rebol"},"author":{"name":"CodinCod","email":"hello@codincod.com"},"license":"MIT","readme":"# @codincod/codemirror-lang-rebol\n\nThis package implements [Rebol](http://www.rebol.com/) and\n[Red](https://www.red-lang.org/) language support for the\n[CodeMirror](https://codemirror.net/) code editor: a\n[Lezer](https://lezer.codemirror.net/) grammar, highlighting, folding and\nindentation.\n\nTwo languages, one lexer. Red is a second implementation of Rebol's syntax with\na preprocessor of its own, and Red/System, which a `.reds` file is written in,\nis that syntax again with other words in it. All three read here, and the\ndialect decides only whether `#include` is a directive or the issue it is\nspelled like.\n\nNo grammar for either existed in the Lezer generation, and none in the\nCodeMirror 5 modes either. There is no tree-sitter grammar for them. What did\nexist, and was worth reading first, is\n[Oldes' Sublime syntax for Rebol](https://github.com/Oldes/Sublime-REBOL) and\n[the one for Red](https://github.com/Oldes/Sublime-Red), which is what GitHub\nitself colours these two languages with, and\n[Pygments' `rebol.py`](https://github.com/pygments/pygments/blob/master/pygments/lexers/rebol.py),\nwhich keeps both lexers in one file for the same reason this package does.\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-rebol/src/branch/master/LICENSE).\n\n## Usage\n\n```javascript\nimport {EditorView, basicSetup} from \"codemirror\"\nimport {rebol} from \"@codincod/codemirror-lang-rebol\"\n\nconst view = new EditorView({\n  parent: document.body,\n  doc: `Rebol [\n  title: \"Greeting\"\n  date: 1-Jan-2020\n]\n\ngreet: func [name [string!] /loud][\n  print either loud [uppercase name][name]\n]\n\ngreet \"world\"\n`,\n  extensions: [basicSetup, rebol()]\n})\n```\n\n`red()` is the same grammar with Red's preprocessor recognised.\n\n## What it reads\n\nRebol states the whole of its syntax in a sentence. A block is a series of\nvalues, loading a script produces a block, and running the script is evaluating\nthat block.\n\nEverything difficult follows from it.\n\n**There are no keywords.** `if`, `print` and `func` are words bound in a context\nto functions, and a script may rebind any of them. What this package colours as\na control word or a builtin is a claim about what a word will most likely mean,\nnever about what it is. The tables are in `src/tokens.ts`.\n\n**The datatype of a value is written into its spelling and nowhere else.** `a/b`\nis a path, `/b` a refinement, `a:` a set-word, `:a` a get-word, `'a` a lit-word,\n`a@b` an email, `a:b` a url, `%a` a file, `<a>` a tag, `1x2` a pair, `1.2.3` a\ntuple, `10:30` a time and `1-Jan-2020/10:30+2:00` a date. None of that can be\ntold apart from the left, because the first character of every one of them is a\ncharacter a word may start with. So the run is read to the next delimiter and\nasked about afterwards, which is what Rebol's own scanner does.\n\nThe slash is the sharp end of it. It ends a token in the scanner and it starts\na path, so `a/b` is one value and `a / b` is three, and the difference is the\nspace. Reading the whole path as one run is what keeps those apart.\n\n**A `<` opens a tag unless what follows makes a word of it.** `<html>` is a tag\nand `<=`, `<>`, `-->` and `<|` are words. Rebol decides this the same way, which\nis why `if a <b [...]` is a syntax error in a language that has no syntax.\n\n**A braced string counts its braces.** `{a {b} c}` is one string, and a `^{`\nis the brace that does not count. That is how a string holding a line break is\nwritten, and it is why the string scanner cannot be a regular expression.\n\n## What the clean figure is worth\n\nAlmost nothing, and it is worth saying so.\n\nParsed against 969 files of real code, this grammar leaves no error node in\n99.90% of them. That number does not mean what the same number means for a\nlanguage with keywords. Rebol has two brackets and no statement, so the only\nthing that can fail a parse is a bracket with no partner. A page of English\nparses. So does a JSON document.\n\nThe figure that does mean something is how much of a file comes back carrying a\nhighlight tag, and on how many distinct colours. Against CodinCod's pool that is\n100.00% of the non-whitespace characters for both languages, across twelve\ncolours for Rebol and eleven for Red, with the busiest of them taking 28.85% and\n32.33%. What the generated fallback managed on the same snippets was 21.78% and\n23.41%, on two colours.\n\nThe corpus is Red's own compiler and runtime, Rebol 3 as Oldes maintains it, and\nCarl Sassenrath's Rebol 2 mezzanine. The single file that fails is missing a\nclosing bracket upstream.\n\n## What it does not read\n\nA block written in a dialect is a block of ordinary values that another function\ninterprets. `parse [some rules]`, `draw [line 0x0 10x10]` and the spec a `func`\ntakes are all coloured as the values they are made of, because a grammar that\ncoloured them as a dialect would be guessing at a binding it cannot see.\n\n`comment [...]` is the same problem wearing a hat. Rebol has no block comment;\n`comment` is a function that throws its argument away. This package colours the\nblock as a block.\n\n## Development\n\n```bash\nnpm test        # the parse specs, the highlighting, the folding and indentation\nnpm run corpus  # error nodes over a directory of real code\nnpm run gaps    # what failed, grouped by shape\n```\n\nThe last two need [lezer-survey](https://codeberg.org/reeven/lezer-survey)\nbeside this repository. No corpus ships here, because none of that code is ours\nto redistribute. [red/red](https://github.com/red/red),\n[Oldes/Rebol3](https://github.com/Oldes/Rebol3) and\n[rebol/rebol](https://github.com/rebol/rebol) are what these figures were taken\nagainst, and `rebol.org`'s script library is the larger collection of code\npeople wrote by hand.\n","readmeFilename":"README.md","_rev":"1-d82cffb05a2d61acf54137dda53bd059"}