Metaparser Plugin

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

This plugin can be used to parse different key-value file formats, in which each line can represent a comment, a key-value pair, or have keys and values following each other on separate lines. Examples of file formats that can be parsed this ways are: .ini, .inc, .properties, .dtd, and various associative array representations in different languages. Note that for some of the common formats Serge offers dedicated parser plugins, which might better support particular format intricacies and require no configuration.

Plugin exports a bunch of configuration parameters — regular expressions — used to identify lines with comments, split keys and values, reset comment context, join multiline strings, and so on. See the sample configuration file below for further documentation.

Code Examples

example.ini
; global comment # another global comment [section] ; localization note foo=Foo bar = Bar ; localization note 2 line 1 ; localization note 2 line 2 baz= Baz [subsection] # comment etc =Etc\nEtc2\nEtc3

Usage

example-project.serge

Reference

multiparser-reference.serge