Perl/PHP/Ruby Associative Array (Hash) Parser Plugin

Plugin source location: <serge_root>/lib/Serge/Engine/Plugin/parse_hash.pm

This plugin is used to parse associative arrays (aka hashes) in 'key' => 'value' format which are used in Perl, PHP, and Ruby. Each key-value pair must be on its own line.

Code Examples

Perl: example.pl
my $localizations = { 'key1' => 'string', 'key2' => 'string', key3 => 'value', # barewords are not supported, skipped 'key4' => 12345, # non-string values are not supported, skipped "key5" => "string", # double-quoted strings are not supported #... };
PHP: example.php
$localizations = array( 'key1' => 'string', 'key2' => 'string', #... );
Ruby: example.rb
localizations = { 'key1' => 'string', 'key2' => 'string', #... }

Limitation: both key and value need to be encased in a single quotation mark symbols. Double-quoted strings or any other language-specific means to denote a string are not supported; symbols (in Ruby) or barewords (in Perl) are not supported, too. Neither supported are multi-line strings.

Usage

example-project.serge