ddollar / simple-parser

Simple parsing library

This URL has Read+Write access

ddollar (author)
Mon Aug 24 22:05:43 -0700 2009
commit  17b8406bd7a1fad009a4934ae4b179148ce8a10b
tree    d2d692edea79fd2bc1aba3f842bc4227a68a8887
parent  9c851aaa04a629300a77e0761598a3a510e7cbcb
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' }