Skip to content

TheFireBlast/irojs

Repository files navigation

Iro.js

A language grammar generator for syntax highlighters.

Installation

npm install irojs

Usage

CLI

Basic syntax

iro compile <source> --targets=<targetlist>

Valid output targets:

  • textmate or tm
    • textmate.xml (default)
    • textmate.json
  • ace
    • ace.js (default)
    • ace.json
  • ast (outputs the rion ast)
  • none

Use <target>.* to match all extensions

Example:

iro compile mygrammar.iro --targets=textmate,ace -o out/

From code

Example:

import * as iro from "irojs";
// or
const iro = require("irojs");

const myGrammar = "...";

var result = iro.compile(myGrammar, { textmate: true });

console.log(result.textmate);

Development

Use pnpm build to build the package.

Use pnpm types to compile the type definition files.