alabamenhu / PrettyRAST

A module to aid in reviewing code generated by RakuAST

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PrettyRAST

A module to aid in reviewing code generated by RakuAST. To use:

    use Pretty::AST;
    pretty-print RakuAST::StrLiteral.new('a'); # "a"
    colorize-RAST; # activate colored output

Color is hard coded at the moment (using xterm-256) to match Comma's default fairly closely.
Down the road, customizable options via some form of a config file will be available. If you intend to use Pretty::RAST inside of Comma IDE (or other IntelliJ-based environment), be aware that colorized output should be avoided, as colorized text is gobbled up in the IDE's terminal.

If you are using this and you run into a node that is not yet support, Pretty::RAST will display as its name in blue flanked by Camilas (e.g. 🦋Node🦋). If this happens, feel free to submit a PR adding support for it. (In the meantime, I'll add them as I end up using them in my own code).

Known issues

  • Code is ugly as sin. This is an initial QAD attempt.
  • Only a small portion of nodes are currently supported
  • Uses overly simple hueristics for whitespacing.

Todo

  • Support more nodes
  • Customizable colors
  • Rewrite indent code to be smarter and more maintainable (and maybe customizable?)
  • Additional output options (html + css?)

License and Copyright

© 2022 Matthew Stephen Stuckwisch. Licensed under the Artistic License 2.0

About

A module to aid in reviewing code generated by RakuAST


Languages

Language:Raku 100.0%