public
Description: Simple parsing library
Homepage:
Clone URL: git://github.com/ddollar/simple-parser.git
Click here to lend your support to: simple-parser and make a donation at www.pledgie.com !
David Dollar (author)
Thu Aug 07 12:38:35 -0700 2008
commit  9c851aaa04a629300a77e0761598a3a510e7cbcb
tree    36b42a7f7f1d8f042b30ef8a9ee2e984a91e2d69
parent  4633a89a7df7090e5568719ac9a0006a2e8d103d
README.markdown

simple-parser

A library to parse simple strings into named tokens

Installation

$ sudo gem install ddollar-simple-parser --source http://gems.github.com

Usage

As a library

>> require 'simple-parser'
>> SimpleParser::String.parse(
     'this is "a test" string',
     ':word1 :: ":phrase1" :word2'
   )

=> { :word1   => 'this',
     :phrase1 => 'a test',
     :word2   => 'string'  }

As a mixin

>> require 'simple-parser'
>> class String; include SimpleParser::String; end

>> 'test now'.parse(':word1 :word2')

=> { :word1 => 'test', :word2 => 'now' }