# irojs

> A grammar generator for syntax highlighters.

Latest version **0.1.5** (published 2024-02-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install irojs
pnpm add irojs
yarn add irojs
bun add irojs
```

Provides the command `iro`.

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.5 |
| Published | 2024-02-15 |
| First published | 2022-06-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 205.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | FireBlast |
| Maintainers | fireblast |
| Keywords | grammar, generator, syntax-highlighting |

## Links

- npm: https://www.npmjs.com/package/irojs
- Homepage: https://thefireblast.github.io/irojs
- npm.io page: https://npm.io/package/irojs

## Dependencies (4)

- [moo](https://npm.io/package/moo.md) ^0.5.2
- [chalk](https://npm.io/package/chalk.md) ^4.1.2
- [plist2](https://npm.io/package/plist2.md) ^1.1.3
- [commander](https://npm.io/package/commander.md) ^12.0.0

## Alternatives

- [@oh-my-pi/pi-natives](https://npm.io/package/@oh-my-pi/pi-natives.md) — 51.8K weekly downloads
- [@capgo/capacitor-light-sensor](https://npm.io/package/@capgo/capacitor-light-sensor.md) — 3.0K weekly downloads
- [@heyhuynhgiabuu/pi-diff](https://npm.io/package/@heyhuynhgiabuu/pi-diff.md) — 492 weekly downloads
- [@lotsa/verdant-lang-asm](https://npm.io/package/@lotsa/verdant-lang-asm.md) — 38 weekly downloads
- [new-era-syntax](https://npm.io/package/new-era-syntax.md) — 20 weekly downloads

## Recent versions

- 0.1.5 (latest) — 2024-02-15
- 0.1.4 — 2024-02-15
- 0.1.3 — 2024-02-15
- 0.1.2 — 2024-02-15
- 0.1.1 — 2022-07-08
- 0.1.0 — 2022-06-30

## README

<h1 align="center">IroJS</h1>
<p align="center">A grammar generator for syntax highlighters.</p>
<br>

This project aims to be a superset of Chris Ainsley's [Iro](https://eeyo.io/iro/), a development tool designed to simplify the creation of syntax highlighters.

<!-- Check out the live editor at https://fireblast.js.org/irojs -->

# Installation

```
npm install irojs
```

# Usage

## From the command line

Basic syntax:
```
iro compile <source> --targets=<targetlist>
```

Available targets:
- `textmate` or `tm`
    - `textmate.xml` *(default)*
    - `textmate.json`
- `ace`
    - `ace.js` *(default)*
    - `ace.json`
- `ast` &mdash; outputs the rion ast
- `all` or `*` &mdash; matches all targets
- `none` &mdash; only checks grammar

Use `<target>.*` to match all extensions.

Example:
```
iro compile mygrammar.iro --targets=textmate,ace -o out/
```

## From code

<!-- TODO: documentation -->

Example:
```js
import * as iro from "irojs";
// or
const iro = require("irojs");

const myGrammar = "...";

var result = iro.compile(myGrammar, { targets: ["textmate"] });

console.log(result.textmate);
```

# Language Documentation

The documentation is still a WIP. In the meanwhile, you can access the original docs at https://web.archive.org/web/20191007073218/https://eeyo.io/iro/documentation/index.html

# Development

<!-- `pnpm test` -> runs all tests. -->

`pnpm build` &rarr; builds the package.

`pnpm build:swc` &rarr; compiles the typescript source.

`pnpm build:rion` &rarr; compiles the rion grammar.

`pnpm build:type` &rarr; generates the type definition files.

## Roadmap

- Online editor
- VSCode extension (language server)
- Styles to CSS
- HighlightJS target
- PrismJS target
- CodeMirror target

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