{"action":"created","issue":{"url":"https://api.github.com/repos/nikic/php-ast/issues/12","labels_url":"https://api.github.com/repos/nikic/php-ast/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/nikic/php-ast/issues/12/comments","events_url":"https://api.github.com/repos/nikic/php-ast/issues/12/events","html_url":"https://github.com/nikic/php-ast/issues/12","id":95625035,"number":12,"title":"Implement pretty printer","user":{"login":"einheitlix","id":1785865,"avatar_url":"https://avatars.githubusercontent.com/u/1785865?v=3","gravatar_id":"","url":"https://api.github.com/users/einheitlix","html_url":"https://github.com/einheitlix","followers_url":"https://api.github.com/users/einheitlix/followers","following_url":"https://api.github.com/users/einheitlix/following{/other_user}","gists_url":"https://api.github.com/users/einheitlix/gists{/gist_id}","starred_url":"https://api.github.com/users/einheitlix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/einheitlix/subscriptions","organizations_url":"https://api.github.com/users/einheitlix/orgs","repos_url":"https://api.github.com/users/einheitlix/repos","events_url":"https://api.github.com/users/einheitlix/events{/privacy}","received_events_url":"https://api.github.com/users/einheitlix/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2015-07-17T09:50:33Z","updated_at":"2015-08-21T16:11:31Z","closed_at":null,"body":"PHP-Parser had a pretty printer that allowed to compile an AST (as generated by PHP-Parser) back to PHP code:\r\nhttps://github.com/nikic/PHP-Parser/blob/1.x/doc/2_Usage_of_basic_components.markdown#pretty-printer\r\n\r\nIt would be great to have something like this in the php-ast extension, allowing for example to manipulate ASTs exposed by this extension and converting them back to PHP code."},"comment":{"url":"https://api.github.com/repos/nikic/php-ast/issues/comments/133477827","html_url":"https://github.com/nikic/php-ast/issues/12#issuecomment-133477827","issue_url":"https://api.github.com/repos/nikic/php-ast/issues/12","id":133477827,"user":{"login":"nikic","id":216080,"avatar_url":"https://avatars.githubusercontent.com/u/216080?v=3","gravatar_id":"","url":"https://api.github.com/users/nikic","html_url":"https://github.com/nikic","followers_url":"https://api.github.com/users/nikic/followers","following_url":"https://api.github.com/users/nikic/following{/other_user}","gists_url":"https://api.github.com/users/nikic/gists{/gist_id}","starred_url":"https://api.github.com/users/nikic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikic/subscriptions","organizations_url":"https://api.github.com/users/nikic/orgs","repos_url":"https://api.github.com/users/nikic/repos","events_url":"https://api.github.com/users/nikic/events{/privacy}","received_events_url":"https://api.github.com/users/nikic/received_events","type":"User","site_admin":false},"created_at":"2015-08-21T16:11:31Z","updated_at":"2015-08-21T16:11:31Z","body":"This will also require some more design work to choose good names. I don't think the list posted above is ideal. There's two things to look out for: Predictable names (so you can make a reasonable guess about how something is called without looking at a dump) and consistent names (similar nodes should have similar names).\r\n\r\nI suspect that the fewer unique names the better and it's preferable to use a common generic name than a rare specific name.\r\n\r\nCurrent list:\r\n\r\n```\r\n\tX(name) \\\r\n\tX(params) \\\r\n\tX(uses) \\\r\n\tX(stmts) \\\r\n\tX(returnType) \\\r\n\tX(extends) \\\r\n\tX(implements) \\\r\n\tX(expr) \\\r\n\tX(var) \\\r\n\tX(offset) \\\r\n\tX(label) \\\r\n\tX(depth) \\\r\n\tX(dim) \\\r\n\tX(prop) \\\r\n\tX(class) \\\r\n\tX(args) \\\r\n\tX(const) \\\r\n\tX(left) \\\r\n\tX(right) \\\r\n\tX(value) \\\r\n\tX(key) \\\r\n\tX(varName) \\\r\n\tX(default) \\\r\n\tX(cond) \\\r\n\tX(declares) \\\r\n\tX(traits) \\\r\n\tX(adaptations) \\\r\n\tX(method) \\\r\n\tX(insteadof) \\\r\n\tX(alias) \\\r\n\tX(prefix) \\\r\n\tX(trueExpr) \\\r\n\tX(falseExpr) \\\r\n\tX(tryStmts) \\\r\n\tX(catches) \\\r\n\tX(finallyStmts) \\\r\n\tX(exception) \\\r\n\tX(type) \\\r\n\tX(init) \\\r\n\tX(loop) \\\r\n\tX(valueVar) \\\r\n\tX(keyVar) \\\r\n```"}}