# cm-tarnation

> An alternative parser for CodeMirror 6

Latest version **0.5.0** (published 2022-05-21) · MPL 2.0 license · 0 weekly downloads

## Install

```sh
npm install cm-tarnation
pnpm add cm-tarnation
yarn add cm-tarnation
bun add cm-tarnation
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.0 |
| Published | 2022-05-21 |
| First published | 2021-09-21 |
| Weekly downloads | 0 |
| License | MPL 2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 6 |
| Unpacked size | 499.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 13 |
| Maintainers | monkatraz |
| Keywords | wikijump, lezer, codemirror, parsing, parser, textmate, grammar, regex, regexp |

## Links

- npm: https://www.npmjs.com/package/cm-tarnation
- Repository: https://github.com/Monkatraz/cm-tarnation
- Homepage: https://github.com/Monkatraz/cm-tarnation#readme
- Issues: https://github.com/Monkatraz/cm-tarnation/issues
- npm.io page: https://npm.io/package/cm-tarnation

## Dependencies (6)

- [@lezer/lr](https://npm.io/package/@lezer/lr.md) ^0.16.3
- [@lezer/common](https://npm.io/package/@lezer/common.md) ^0.16.0
- [@lezer/highlight](https://npm.io/package/@lezer/highlight.md) ^0.16.0
- [@codemirror/state](https://npm.io/package/@codemirror/state.md) ^0.20.0
- [@codemirror/language](https://npm.io/package/@codemirror/language.md) ^0.20.2
- [@codemirror/autocomplete](https://npm.io/package/@codemirror/autocomplete.md) ^0.20.1

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 0.5.0 (latest) — 2022-05-21
- 0.4.0 — 2022-03-13
- 0.3.0 — 2022-03-11
- 0.2.0 — 2022-02-28
- 0.1.1 — 2021-12-08
- 0.1.0 — 2021-09-21

## README

# cm-tarnation

An alternative parser for CodeMirror 6. Its grammar focuses on being extremely flexible while not suffering the consequence of being utterly impossible to understand. It's inspired a bit by the Monarch and Textmate grammar formats, but pretty much entirely avoids the pitfalls of their systems.

Tarnation is _not_ line-based. It is capable of reusing both previous _and ahead_ data when parsing, making it fully incremental. It can restart from nearly any point in a document, and usually only barely parses the immediate region around an edit. It also doesn't use very much memory, due to some clever usage of `ArrayBuffer` based tokens.

Tarnation was created as part of my work on [Wikijump](https://github.com/scpwiki/wikijump/).

### Why?

Tarnation can do things that Lezer (the parser you'd usually use for CodeMirror) can't. For example, Tarnation can parse something like Markdown, and other weird esoteric markup/formatting languages.

However, if you're not trying to make a grammar for some bonkers language, it's probably possible to make a grammar using Lezer. You should almost certainly do this - its grammar format is probably superior to Tarnation's, and it will be faster and better behaved in general.

## Installation

```
npm install cm-tarnation
```

## Usage

Tarnation's grammar is basically a JSON matching a certain schema. It's designed more around YAML, though.

TODO

## Contributing

Tarnation is welcome to PRs, issues, etc. If you want to understand how Tarnation works, I made sure to spend a lot of time nicely documenting the source files. It's not all that complicated really. It would help you a lot if you read up on how CodeMirror itself works, though.

### Building

Tarnation is built using TypeScript, with no special build tools. You can use the following command:

```
npm run build
```

## License

MPL 2.0. See the [license file](LICENSE) for more details.

---
_Source: https://npm.io/package/cm-tarnation · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
