Skip to content

bbtgp/php-unparser

 
 

Repository files navigation

php-unparser

Build Status Coverage Status

This project is a JavaScript based unparser for the AST produced by glayzzle's php-parser.

It aims to produce code that uses the style format recommended by PSR-1 and PSR-2.

It's at an early development stage, but it is already able to generate code for most of the produced AST. It has no dependencies.

How to use

var unparse = require('php-unparser');
var ast = {
  "kind": "program",
  "children": [
    {
      "kind": "echo",
      "arguments": [
        {
          "kind": "string",
          "value": "hello world",
          "isDoubleQuote": true
        }
      ]
    }
  ],
  "errors": []
};

console.log(unparse(ast)); // Will output -> echo "hello world";

Demo

See it working

License

MIT License, Copyright 2016 Christopher Luna

About

A JavaScript based code generator, to unparse glayzzle/php-parser compatible AST back to code.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 90.9%
  • PHP 7.5%
  • Makefile 1.6%