mangudai
v0.3.0
Published
AoE2 Random Map Scripting for humans
Downloads
9
Maintainers
Readme
Mangudai
AoE2 Random Map Scripting for humans
JavaScript parser and linter for Random Map Scripts (RMS) for the Age of Empires II video game.
Install
Mangudai is published as an NPM package compatible with Node.js and browsers.
npm install mangudai
Use a tool like Webpack or Rollup to include Mangudai in your front-end app.
The code is compiled to ES5 (old and stable JavaScript) before publishing, so the module has maximum compatibility out-of-the-box.
Usage
Let's parse an RMS script into an Abstract Syntax Tree (AST) and lint it.
import { parse, lint } from 'mangudai'
const { ast, errors } = parse('<PLAYER_SETUP> \n random_placement')
if (errors.length) {
console.log('Unable to parse the script! Probably invalid syntax.', errors)
} else {
const lintErrors = lint(ast)
console.log(`Linter found ${lintErrors.length} problems.`, lintErrors)
}
Mangudai is written in TypeScript and exports all relevant typings.
API
parse( script:
string
) => { ast:Script
, errors:ParseError[]
}lint( ast:
Script
) =>LintError[]
Contribute
This project is still in its early development stage. Any help is greatly appreciated! Feel free to ask questions in issues. PRs accepted.
License
MIT © Mangudai contributors