{"_id":"@codincod/codemirror-lang-wren","_rev":"3-fff54cf508bb14531316c7b3337fd816","name":"@codincod/codemirror-lang-wren","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"@codincod/codemirror-lang-wren","version":"0.1.0","keywords":["editor","code","wren","codemirror"],"author":{"name":"CodinCod","email":"hello@codincod.com"},"license":"MIT","_id":"@codincod/codemirror-lang-wren@0.1.0","maintainers":[{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"}],"homepage":"https://codincod.com/","dist":{"shasum":"bef2525a6d52ab6c8a0ae6db191cece52fe813d0","tarball":"https://registry.npmjs.org/@codincod/codemirror-lang-wren/-/codemirror-lang-wren-0.1.0.tgz","fileCount":14,"integrity":"sha512-1rpSI2FwVkvktDpZX2JmLxbTg2cWNwZuNsdwa5yBHQf1Z5ZciYP94DHr+Yx9L290IP7qwHuvCjrEYntEI/3mwg==","signatures":[{"sig":"MEQCIBXDjXznhkFaw9jWXi3vOKM7ov0GKCD58pIBO43j3/kIAiARPkHZwForKgC8Z2150X4GkoHrn7fG6THBGCOEcSW26A==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":98453},"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":"45e468ff34a8d0f9c517b971f7c269581141b59f","scripts":{"test":"npm run build && node --test \"test/*.test.ts\"","build":"rm -rf dist && lezer-generator src/wren.grammar -o src/parser.js && cm-buildhelper src/wren.ts","corpus":"npm run build && node test/corpus.ts","prepare":"npm run build","build-debug":"lezer-generator src/wren.grammar --names -o src/parser.js && cm-buildhelper src/wren.ts"},"_npmUser":{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"},"repository":{"url":"git+https://codeberg.org/reeven/codemirror-lang-wren.git","type":"git"},"_npmVersion":"11.6.2","description":"Wren 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","@codemirror/autocomplete":"^6.20.3"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.6.0","@lezer/generator":"^1.8.0","@codemirror/state":"^6.7.1","@codemirror/buildhelper":"^1.0.2"},"_npmOperationalInternal":{"tmp":"tmp/codemirror-lang-wren_0.1.0_1785902353640_0.283240700307716","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@codincod/codemirror-lang-wren","version":"0.1.1","keywords":["editor","code","wren","codemirror"],"author":{"name":"CodinCod","email":"hello@codincod.com"},"license":"MIT","_id":"@codincod/codemirror-lang-wren@0.1.1","maintainers":[{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"}],"homepage":"https://codincod.com/","dist":{"shasum":"d4611de25e86d9f388d0b892404eb3de7e294703","tarball":"https://registry.npmjs.org/@codincod/codemirror-lang-wren/-/codemirror-lang-wren-0.1.1.tgz","fileCount":14,"integrity":"sha512-q5IRhO/t0zXI+ZpWgxHkIK81LkcDqb7hjy9vv+j6cjBK6HvZ4J5UP7J49g78QPcKqnucAD1n6yxmJ5fidFXboQ==","signatures":[{"sig":"MEUCIQDL9zfCipO4YaYmd18Aa1s5fnyDP/RCVvEIobydfXeErAIgAsTbE4JbG1RGjf2OxvuKx25cNuqpbXvW7UZ0nzM4JAc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":98628},"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":"a34f7bdb646f932a29df995666fcd83e6d8980d3","scripts":{"gaps":"npm run build && node ../lezer-survey/src/cli.ts gaps --group parent --set-aside \"// expect error\"","test":"npm run build && node --test \"test/*.test.ts\"","build":"rm -rf dist && lezer-generator src/wren.grammar -o src/parser.js && cm-buildhelper src/wren.ts","corpus":"npm run build && node ../lezer-survey/src/cli.ts measure --group parent --set-aside \"// expect error\"","prepare":"npm run build","build-debug":"lezer-generator src/wren.grammar --names -o src/parser.js && cm-buildhelper src/wren.ts"},"_npmUser":{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"},"repository":{"url":"https://codeberg.org/reeven/codemirror-lang-wren","type":"git"},"_npmVersion":"11.6.2","description":"Wren 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","@codemirror/autocomplete":"^6.20.3"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.6.0","@lezer/generator":"^1.8.0","@codemirror/state":"^6.7.1","@codemirror/buildhelper":"^1.0.2"},"_npmOperationalInternal":{"tmp":"tmp/codemirror-lang-wren_0.1.1_1785971109838_0.5416991505532518","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@codincod/codemirror-lang-wren","version":"0.2.0","description":"Wren language support for the CodeMirror code editor","keywords":["editor","code","wren","codemirror"],"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,"dependencies":{"@codemirror/autocomplete":"^6.20.3","@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.8.0","typescript":"^5.6.0"},"homepage":"https://codincod.com/","repository":{"type":"git","url":"https://codeberg.org/reeven/codemirror-lang-wren"},"scripts":{"build":"rm -rf dist && lezer-generator src/wren.grammar -o src/parser.js && cm-buildhelper src/wren.ts","build-debug":"lezer-generator src/wren.grammar --names -o src/parser.js && cm-buildhelper src/wren.ts","test":"npm run build && node --test \"test/*.test.ts\"","measure":"npm run build && node ../lezer-survey/src/cli.ts measure --group parent --set-aside \"// expect error\"","fuzz":"npm run build && node ../lezer-survey/src/cli.ts fuzz","gaps":"npm run build && node ../lezer-survey/src/cli.ts gaps --group parent --set-aside \"// expect error\""},"_id":"@codincod/codemirror-lang-wren@0.2.0","_integrity":"sha512-EX/eDKBSzi0aKTq7YihrxmNtfjM9MbgF/OgdXRoLzpuNvxwwikb1Qk8sDTVOvLVQNC4NetzYGSvaqqdtdeUxoQ==","_resolved":"/tmp/0ca64cbe118159997c51bd1d0296c4b0/codincod-codemirror-lang-wren-0.2.0.tgz","_from":"file:codincod-codemirror-lang-wren-0.2.0.tgz","_nodeVersion":"25.0.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-EX/eDKBSzi0aKTq7YihrxmNtfjM9MbgF/OgdXRoLzpuNvxwwikb1Qk8sDTVOvLVQNC4NetzYGSvaqqdtdeUxoQ==","shasum":"2ce986812bfdb00e22aa53696cc722fe045f2794","tarball":"https://registry.npmjs.org/@codincod/codemirror-lang-wren/-/codemirror-lang-wren-0.2.0.tgz","fileCount":14,"unpackedSize":100082,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDddcB1lPV3x/AZ0AeNVo9j7i+i4zoYLtIb/HbkWtcPlgIhAOWlZ2OEU9/v8vF6WP7AesT+s0d6k3hWDpnqJpYAcYY9"}]},"_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-wren_0.2.0_1786831963010_0.5614909852281353"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-05T03:59:13.509Z","modified":"2026-08-15T22:12:43.396Z","0.1.0":"2026-08-05T03:59:13.770Z","0.1.1":"2026-08-05T23:05:10.012Z","0.2.0":"2026-08-15T22:12:43.222Z"},"author":{"name":"CodinCod","email":"hello@codincod.com"},"license":"MIT","homepage":"https://codincod.com/","keywords":["editor","code","wren","codemirror"],"repository":{"type":"git","url":"https://codeberg.org/reeven/codemirror-lang-wren"},"description":"Wren language support for the CodeMirror code editor","maintainers":[{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"}],"readme":"# @codincod/codemirror-lang-wren\n\nThis package implements [Wren](https://wren.io/) language support for the\n[CodeMirror](https://codemirror.net/) code editor: a\n[Lezer](https://lezer.codemirror.net/) grammar, highlighting, indentation,\nfolding and completion for the core library.\n\nIt is a fork of Josh Goebel's\n[@exercism/codemirror-lang-wren](https://github.com/exercism/codemirror-lang-wren),\nwhich is the only Lezer grammar Wren has ever had. Its precedence table and the\nshape of its expression rules are kept; the rest is below.\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-wren/src/branch/master/LICENSE).\n\n## Usage\n\n```javascript\nimport {EditorView, basicSetup} from \"codemirror\"\nimport {wren} from \"@codincod/codemirror-lang-wren\"\n\nconst view = new EditorView({\n  parent: document.body,\n  doc: `class Point {\n  construct new(x, y) {\n    _x = x\n    _y = y\n  }\n\n  x { _x }\n  y { _y }\n\n  +(other) { Point.new(_x + other.x, _y + other.y) }\n\n  toString { \"(%(_x), %(_y))\" }\n}\n\nvar points = [Point.new(1, 2), Point.new(3, 4)]\nSystem.print(points.reduce { |a, b| a + b })\n`,\n  extensions: [basicSetup, wren()]\n})\n```\n\n## What this fixes\n\nThe first reason for the fork is that upstream cannot be used: it is built for\nCodeMirror 0.19 and `lezer` 0.13, so its `LanguageSupport` is not the one a\nCodeMirror 6 editor recognises, and its parser is not one `@lezer/lr` can run.\nNothing in the editor throws; the language simply never arrives.\n\nThe second is the parse. Measured over 1020 files (3.06 MiB) of Wren's own test\nsuite, the Wren CLI, wren-console and DOME, upstream's grammar reads **83.82%**\nof them with no error node, leaving 883 error nodes. This package reads\n**100.00%**, leaving none. The 159 files in that suite meant not to compile are\nskipped by both.\n\nMeasured over a wider corpus, 9945 files harvested from GitHub, this package\nreads **96.03%** with no error node. A tenth of what a `.wren` harvest collects\nis IFJ25, the language a Czech compiler course sets as its target, and its\nnegative test suites go with it; those files are in a corpus of their own.\n\nFour of the fixes are ordinary bugs.\n\n* **A range was two numbers.** The number token ended at `1.`, so `1..10` lexed\n  as `1.` and `.10` with an error node between them, and `RangeOp` never\n  appeared in a tree. A digit is now required after the point, which is what\n  Wren requires too.\n* **A class name had to be capitalised.** `class foo` is legal Wren and did not\n  parse. The case of a name says nothing where only a class can stand.\n* **`static` and `construct` could be members of their own.** A member was\n  allowed to be a bare name, so `static origin { }` read as two members, the\n  first of them called `static`. Only a foreign method has no body, and it says\n  so now.\n* **A class could only inherit from a name.** Wren reads an expression there and\n  rejects a non-class when it runs, which is why its own test suite holds\n  `class Foo is null`.\n\nThree are syntax Wren has and upstream never had.\n\n* **Attributes**: `#key`, `#key = value`, `#group(a, b = c)` and the runtime\n  `#!` form, on a class and on a method.\n* **The subscript operators**: `[index] { }` and `[index]=(value) { }`, and `is`\n  as a method name beside the other operators.\n* **A shebang**, which Wren skips and every script written for the CLI opens\n  with.\n\nAnd two are the language read more closely.\n\n* **A line break ends a statement.** Wren spends no semicolons and upstream had\n  no statement separator at all, so `step` and a block under it read as one call\n  taking a block rather than as two statements, and a getter followed by\n  anything at all ran the two together. A zero-width token now ends a statement\n  wherever a line break did, in the way `@lezer/javascript` inserts a semicolon.\n  The two places the answer runs the other way are handled too: `return` takes a\n  value only from the rest of its line, and so does `import \"io\" for Stdin`. A\n  leading dot carries a call chain on, which Wren allows and its own\n  `chained_newline.wren` spends twenty lines on.\n* **Fields, classes and names are told apart.** `_count`, `__count`, `Point` and\n  `count` all reach different nodes, so a theme can colour them differently.\n  Strings are cut into their pieces rather than read a character at a time, and\n  `\"\"\"raw\"\"\"` takes neither escapes nor holes, which is what makes it raw.\n\n`SequenceExpression` and the object patterns are gone. Both were left over from\nthe JavaScript grammar this one started as, and Wren has no comma operator and\nno destructuring.\n\n## Measuring it yourself\n\n```bash\nnpm run corpus -- path/to/wren/files\n```\n\nNo corpus ships with the package, because none of that code is ours to\nredistribute. Point it at your own; it counts files with no error node and\ngroups them by directory, so a project that drags the total down names itself.\n","readmeFilename":"README.md"}