#miniserde #serialization #ast #json #turn #full-moon #luaparse

full-moon-compat-luaparse

A serializer to turn a full-moon AST into luaparse.js-compatible JSON (using miniserde)

1 unstable release

0.1.0 Aug 4, 2020

#4 in #miniserde

MPL-2.0 license

47KB
1.5K SLoC

full-moon-compat-luaparse

This crate contains some wrapper types with miniserde::Serialize implementations to serialize a full-moon AST into a JSON file that is compatible with luaparse


lib.rs:

full-moon <-miniserde-> luaparse.js

This is a silly library I wrote to bridge the gap between some software I had written previously that worked with the JSON output from luaparse.js and the full_moon lua parsing library that I chose.

It offers a range of wrapper types around the types from full-moon and implements the miniserde::Serialize trait from miniserde on them. Use the Chunk::wrap(ast) method on some Ast from full-moon to get started.

You can then use miniserde::json::to_string(x) on any x that implements miniserde::Serialize, such as the Chunk mentioned above.

Note: This library includes some code that works around issues such as missing operator precendence in full-moon. The upstream author is currently reworking the parser so there was no point in trying to fork the current API.

Dependencies

~4MB
~86K SLoC