- Related Tickets in Parrot
- Adding more highlightings
- COPYRIGHT AND LICENSE
Padre::Plugin::Parrot - Experimental Padre plugin for Parrot
This Plugin provides several features
Syntax highlighting via the PGE parse tree for languages using PCT - the Parrot Compiler Toolkit
Syntax highlighting of PIR and PASM files using Perl 5 regular expressions
Embedding of Parrot to allow extending Padre using languages running in Parrot
After installation you need to enable the plugin via the Plugin Manager of Padre. Once that is done there should be a menu option Plugins/Parrot with several submenus.
About is just some short explanation
The other menu options will count the number of characters in the current document using the current Perl 5 interpreter or PASM running on top of Parrot. Later we add other implementations running on top of Parrot.
The syntax highlighting provided by this module can be enabled on a perl file-type (actually mime-type) base in the Edit/Preferences/Mime-types dialog.
This whole plugin is quite experimental. So is the documentation. I hope the plugin can work with released and installed versions of Parrot as well but I have never tried that. Let me outline how I install the dependencies.
It is quite simple though it has several steps in it.
Later we'll make this more simple.
I start with Rakudo (the implementation of Perl 6 on Parrot).
$ cd $HOME $ mkdir work $ cd work $ git clone git://github.com/rakudo/rakudo.git $ cd rakudo $ perl Configure.pl --gen-parrot $ make
Configure env variables
Configure PARROT_DIR to point to the root of parrot Configure RAKUDO_DIR to point to the directory where rakudo was checked out. (I have these in the .bashrc)
$ export PARROT_DIR=$HOME/work/rakudo/parrot $ export RAKUDO_DIR=$HOME/work/rakudo
Once this is done if you run Padre now you can enable Parrot/PGE highlighting of Perl 6 files via the Edit/Preferences/Mime-types dialog.
Adding Cardinal (Ruby) highlighting
In order to support Ruby highlighting one needs to configure the CARDINAL_DIR environment variable to point to the place where the cardinal.pbc can be located.
$ cd $HOME/work $ git clone git://github.com/cardinal/cardinal.git $ export CARDINAL_DIR=$HOME/work/cardinal # add this also to .bashrc $ cd $PARROD_DIR $ mkdir languages $ cd language $ ln -s $CARDINAL_DIR $ cd cardinal $ perl Configure.pl $ make
Once this is done if you run Padre now you can enable Parrot/PGE highlighting of Ruby files via the Edit/Preferences/Mime-types dialog.
Configure LD_LIBRARY_PATH (also in .bashrc)
$ export LD_LIBRARY_PATH=$PARROT_DIR/blib/lib/
$ cd $PARROT_DIR/ext/Parrot-Embed/ ./Build realclean perl Build.PL ./Build ./Build test
The test will give a warning like this, but will pass:
Parrot VM: Can't stat no file here, code 2. error:imcc:syntax error, unexpected IDENTIFIER in file 'EVAL_2' line 1
Now if you run Padre and enable Padre::Plugin::Parrot it will have an embedded Parrot interpreter that can run code written in PIR. (See the Plugins/Parrot/Count Characters...) menu options.
Related Tickets in Parrot
https://trac.parrot.org/parrot/ticket/77 https://trac.parrot.org/parrot/ticket/74 https://trac.parrot.org/parrot/ticket/76 https://trac.parrot.org/parrot/ticket/79 https://trac.parrot.org/parrot/ticket/77
Adding more highlightings
In order to add more syntax highlighters one needs to
make sure the relevant language can compile to a pbc file
add and entry to the @config variable.
add color codes to the missing tokens in Padre::Plugin::Parrot::ColorizeTask
Eliminate the need for environment variables
Make the installations more simple, make sure it can work with released and installed versions of Parrot, Rakudo etc.
Allow the addition and configuration of more .pbc files (or executables) to @config (and keep it in the Padre config database).
Separate the token lists for the various languages Padre::Plugin::Parrot::ColorizeTask
Automatically colorize any file type if it does not have a specified token to colors table.
Gabor Szabo http://szabgab.com/
Ahmad M. Zawawi <email@example.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2010 by Gabor Szabo.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.