{"_id":"@codincod/codemirror-lang-tcl","_rev":"4-b2821b819ea7a3e200d96863517da44e","name":"@codincod/codemirror-lang-tcl","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"@codincod/codemirror-lang-tcl","version":"0.1.0","keywords":["codemirror","code","editor","tcl","tk"],"author":{"name":"CodinCod","email":"hello@codincod.com"},"license":"MIT","_id":"@codincod/codemirror-lang-tcl@0.1.0","maintainers":[{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"}],"homepage":"https://codincod.com/","dist":{"shasum":"e347c6a777451edf8c50ef8b2fa0caabc97c88e4","tarball":"https://registry.npmjs.org/@codincod/codemirror-lang-tcl/-/codemirror-lang-tcl-0.1.0.tgz","fileCount":13,"integrity":"sha512-yeMmSESvK04v6KEp9uba2NYO+aTSEjW+g0Vjcxi//D246UPA+hSSz9nttpCbpp3uFlJd50FaNFClWoXz7gqR3g==","signatures":[{"sig":"MEQCIGm4iGosJE9MXPPCnYqwjOfs5gAePd7iP4EE1BULHB4RAiAPwcyHgdqffmg5cgaJ2Z2z6jICU3LflgKefKYTTBuLYQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":91518},"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":"a0db16ef4e64e614a1387a2ebb185998398372d9","scripts":{"gaps":"npm run build && node ../lezer-survey/src/cli.ts gaps --group parent","test":"npm run build && node --test \"test/*.test.ts\"","build":"rm -rf dist && lezer-generator src/tcl.grammar -o src/parser.js && cm-buildhelper src/tcl.ts","corpus":"npm run build && node ../lezer-survey/src/cli.ts measure --group parent","prepare":"npm run build","build-debug":"lezer-generator src/tcl.grammar --names -o src/parser.js && cm-buildhelper src/tcl.ts"},"_npmUser":{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"},"repository":{"url":"git+https://codeberg.org/reeven/codemirror-lang-tcl.git","type":"git"},"_npmVersion":"11.6.2","description":"Tcl 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.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-tcl_0.1.0_1785968848174_0.2352967421076162","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@codincod/codemirror-lang-tcl","version":"0.1.1","keywords":["codemirror","code","editor","tcl","tk"],"author":{"name":"CodinCod","email":"hello@codincod.com"},"license":"MIT","_id":"@codincod/codemirror-lang-tcl@0.1.1","maintainers":[{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"}],"homepage":"https://codincod.com/","dist":{"shasum":"e54f13691a0c7bf782ae75a746d9804484f5659d","tarball":"https://registry.npmjs.org/@codincod/codemirror-lang-tcl/-/codemirror-lang-tcl-0.1.1.tgz","fileCount":13,"integrity":"sha512-F3iY7XfKkovvMon9EnaZKAleWTtvbFZn/FpbjGuw11l+/Mwcqn3NIA9LPFUXuGEEaTZo/1iXVBHXZEry41jfSw==","signatures":[{"sig":"MEQCIEpEjvtZ36TaUHmW+UGJ6oULQGpnzcSPiQ0CPOlVeEYlAiAQ+VAlU1i5Xv9afYElMUhMAcRQMnBc/S0gaKsb3tuNWw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":91510},"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":"a0db16ef4e64e614a1387a2ebb185998398372d9","scripts":{"gaps":"npm run build && node ../lezer-survey/src/cli.ts gaps --group parent","test":"npm run build && node --test \"test/*.test.ts\"","build":"rm -rf dist && lezer-generator src/tcl.grammar -o src/parser.js && cm-buildhelper src/tcl.ts","corpus":"npm run build && node ../lezer-survey/src/cli.ts measure --group parent","prepare":"npm run build","build-debug":"lezer-generator src/tcl.grammar --names -o src/parser.js && cm-buildhelper src/tcl.ts"},"_npmUser":{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"},"repository":{"url":"https://codeberg.org/reeven/codemirror-lang-tcl","type":"git"},"_npmVersion":"11.6.2","description":"Tcl 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.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-tcl_0.1.1_1785969031363_0.9831653225863761","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@codincod/codemirror-lang-tcl","version":"0.1.2","keywords":["codemirror","code","editor","tcl","tk"],"author":{"name":"CodinCod","email":"hello@codincod.com"},"license":"MIT","_id":"@codincod/codemirror-lang-tcl@0.1.2","maintainers":[{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"}],"homepage":"https://codincod.com/","dist":{"shasum":"14273bc66176261b2c6942bb7c8e09b151f933b0","tarball":"https://registry.npmjs.org/@codincod/codemirror-lang-tcl/-/codemirror-lang-tcl-0.1.2.tgz","fileCount":13,"integrity":"sha512-XGH6tS44pNMU+MX81nkSDns3T95iAhgdHYmaSkRnYRO2bipjI905WrUdn29r5adAeIsMGrbWgt0ZWr0YimMydA==","signatures":[{"sig":"MEQCIDp2ccqbUFt8SwqiMbVqPKAfAJ5WsoZoQfoj8YxkO3B7AiBL3GcuGsujHpWaYRxctb2Tc3Kh3s6yZjP/D8HuIvWLUw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":92168},"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":"a972c62ea9bc1b3ac689ac6f3ed4a6f0d32e4e7d","scripts":{"fuzz":"npm run build && node ../lezer-survey/src/cli.ts fuzz","gaps":"npm run build && node ../lezer-survey/src/cli.ts gaps --group parent","test":"npm run build && node --test \"test/*.test.ts\"","build":"rm -rf dist && lezer-generator src/tcl.grammar -o src/parser.js && cm-buildhelper src/tcl.ts","corpus":"npm run build && node ../lezer-survey/src/cli.ts measure --group parent","prepare":"npm run build","build-debug":"lezer-generator src/tcl.grammar --names -o src/parser.js && cm-buildhelper src/tcl.ts"},"_npmUser":{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"},"repository":{"url":"https://codeberg.org/reeven/codemirror-lang-tcl","type":"git"},"_npmVersion":"11.6.2","description":"Tcl 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","@codemirror/autocomplete":"^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-tcl_0.1.2_1786490111265_0.03006262215763611","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@codincod/codemirror-lang-tcl","version":"0.2.0","description":"Tcl language support for the CodeMirror code editor","keywords":["codemirror","code","editor","tcl","tk"],"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/tcl.grammar -o src/parser.js && cm-buildhelper src/tcl.ts","build-debug":"lezer-generator src/tcl.grammar --names -o src/parser.js && cm-buildhelper src/tcl.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 parent","fuzz":"npm run build && node ../lezer-survey/src/cli.ts fuzz","gaps":"npm run build && node ../lezer-survey/src/cli.ts gaps --group parent"},"dependencies":{"@codemirror/autocomplete":"^6.0.0","@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-tcl"},"gitHead":"27fd7e49f37d49ee8bdf6966ed2b7e8f7728a2d5","_id":"@codincod/codemirror-lang-tcl@0.2.0","_nodeVersion":"25.0.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-dBI/2+fgWR2Yjyiu3ZfQT5neaL+PCU/mJF5IXKidcKW6WtrKtVZXjSZ+QA2uKL0CziLKUTwQyyNWdkpz5YCBBg==","shasum":"36623ddbf6da73a442bd422b311d605b2897d8b9","tarball":"https://registry.npmjs.org/@codincod/codemirror-lang-tcl/-/codemirror-lang-tcl-0.2.0.tgz","fileCount":13,"unpackedSize":92169,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCrso94FFDTJWoLFo4YGpTVZOLW+wm7vBbHu19jYrMVJAIgR0mm1lCNV3yMsDaBFypFM9SIRpZYyA98i6kE3+3iCmk="}]},"_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-tcl_0.2.0_1786761120580_0.5679749954551419"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-05T22:27:28.003Z","modified":"2026-08-15T02:32:00.905Z","0.1.0":"2026-08-05T22:27:28.302Z","0.1.1":"2026-08-05T22:30:31.515Z","0.1.2":"2026-08-11T23:15:11.449Z","0.2.0":"2026-08-15T02:32:00.710Z"},"author":{"name":"CodinCod","email":"hello@codincod.com"},"license":"MIT","homepage":"https://codincod.com/","keywords":["codemirror","code","editor","tcl","tk"],"repository":{"type":"git","url":"https://codeberg.org/reeven/codemirror-lang-tcl"},"description":"Tcl language support for the CodeMirror code editor","maintainers":[{"name":"juicemitapfelndrin","email":"juicemitapfelndrin@gmail.com"}],"readme":"# @codincod/codemirror-lang-tcl\n\nThis package implements [Tcl](https://www.tcl-lang.org/) language support for\nthe [CodeMirror](https://codemirror.net/) code editor: a\n[Lezer](https://lezer.codemirror.net/) grammar, highlighting, indentation,\nfolding and completion for the commands `tclsh` starts with.\n\nThe grammar is written from scratch, against the twelve rules of `Tcl(n)`.\nThere was a Lezer grammar for Tcl on npm before this one, and measured against\nthe 1359 Tcl snippets [CodinCod](https://codincod.com/) keeps, it left seventy\nerror nodes in the average file. A tree that is mostly error nodes colours\nworse than the CodeMirror 5 stream mode it was meant to replace, which is why\nthat mode was still in use.\n\nThis one reads 99.00% of those snippets with no error node, and 96.41% of the\nTcl core, Tk, tcllib and tklib: 2283 files, 33 MiB.\n\nWritten in part for CodinCod, a competitive coding platform, where it colours\nthe editor people solve puzzles in.\n\nThis code is released under an\n[MIT license](https://codeberg.org/reeven/codemirror-lang-tcl/src/branch/master/LICENSE).\n\n## Usage\n\n```javascript\nimport {EditorView, basicSetup} from \"codemirror\"\nimport {tcl} from \"@codincod/codemirror-lang-tcl\"\n\nconst view = new EditorView({\n  parent: document.body,\n  doc: `proc fact {n} {\n    if {$n <= 1} {\n        return 1\n    }\n    return [expr {$n * [fact [expr {$n - 1}]]}]\n}\n\nputs [fact 10]\n`,\n  extensions: [basicSetup, tcl()]\n})\n```\n\n## What a braced word holds\n\nTcl has no expression syntax and no statement syntax. A script is commands, a\ncommand is words, and what a word means is the business of the command it is\nhanded to. `{$x + 1}` is an expression to `expr`, a script to `eval`, a\ntwo-element list to `lappend` and eight characters to `string length`, and the\nbraces are the same braces. No parser can be told which without being told\nwhat every command does.\n\nFour commands are written out in the grammar, because reading their braced\nwords as anything else colours them wrong: `proc` takes a list of parameters,\nand `if`, `while` and `for` take a condition, which is where the operator\ntable on the `expr` manual page applies.\n\nEvery other braced word is read as a script. That is what one is whenever it\nis long enough to be worth colouring, and a procedure body left as an opaque\nrun of characters is the one outcome worse than colouring a list of names as\nthough the first were a command.\n\n## What the tokenizer decides\n\nFour things a context-free grammar cannot say are settled in `src/tokens.ts`,\neach of them by asking the parser what it has room for:\n\n* **A word is a run of pieces that touch.** `a$b[c]d` is one argument and\n  `a $b [c] d` is four, so a piece may only join the one before it when\n  nothing stands between them.\n* **A brace and a quote are only special where a word begins.** `a{b}` is the\n  four characters it looks like.\n* **A command name is only a command name in the first word of a command.**\n  `if` opens a conditional and `lappend l if` appends two letters.\n* **`#` opens a comment only where a command may start**, and stops at the\n  brace that closes the word it is written in. Tcl counts braces before it\n  knows what a comment is, so `{a ;# b}` is a whole word.\n\nTwo further things are read the way Tcl's own two passes read them. A quote\nthat never closes before the enclosing braced word ends is a quote and not the\nstart of a string, and so is a `[` with no `]` to answer it: a line of\nsomebody's test data would otherwise take the rest of the file with it.\n\n## Development\n\n```bash\nnpm install\nnpm test\n```\n\n`npm run corpus` and `npm run gaps` measure the grammar against a directory of\nreal Tcl and group what it could not parse. Both want\n[lezer-survey](https://codeberg.org/reeven/lezer-survey) beside this checkout,\nand a corpus of their own: no code ships here that is not ours.\n","readmeFilename":"README.md"}