Home

Awesome

<h1 align="center">Mab, a Lossless Lua Parser in Rust</h1> <div align="center"> <a href="https://travis-ci.org/LPGhatguy/mab"> <img src="https://api.travis-ci.org/LPGhatguy/mab.svg?branch=master" alt="Travis-CI build status" /> </a> </div> <hr /> <div align="center"> <h2>No Longer Maintained</h2> <h3> Check out <a href="https://github.com/kampfkarren/full-moon">Full Moon</a> instead, mab's successor! </h3> </div> <hr />

This is a work in progress lossless Lua 5.1+ parser written in Rust. It will preserve all comments, whitespace, and style distinctions like quotes and escaping.

I want to use Mab for a number of future projects:

Goals

Contributing

Contributions are welcome -- there is a lot of work to be done!

Mab supports Rust 1.26 stable and newer.

There is already a fairly sizable test suite implemented as a "parse by example" system. Test file inputs are located in parse_examples/source.

The test runner (cargo test) will read, tokenize, and parse these source files and check the last-known good results folder (parse_examples/results) to see if they match what they did before.

If you're making changes that modify the parser's AST, delete the corresponding serialized token list and AST JSON files. When you run the test runner next, it will generate files that should be manually reviewed and submitted alongside your change. Git's diff viewer can help identify if what was changed was intentional.

Be careful with line endings when developing on Windows. The repository has a .editorconfig file as well as a .gitattributes file to try to guarantee that all Lua files have LF line endings as opposed to CRLF. Checking in a parse by example token list with CRLF line endings baked into it will cause CI to fail.

License

This project is available under the terms of The Mozilla Public License, version 2.0. Details are available in LICENSE.