[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: argument parsing with embedded parentheses

Ban Hoang

8/23/2006 9:42:00 PM


Hi,

How about parsing a parameter list with embedded white space between two
words and EOF?

Thanks,
-----------------------------------------

Bil Kleb wrote:
>
> Hello,
>
> Can someone please point me at a simple recipe for
> parsing a parameter list with embedded parentheses
> and commas, e.g.,
>
> class String
> def get_args
> split(',').map{|e| e.strip} # naive recipe
> end
> end
>
> require 'test/unit'
>
> class TestArgumentParser < Test::Unit::TestCase
> def test_simple_cases
> assert_equal %w[ a b ], 'a,b'.get_args
> assert_equal %w[ a_frog b25 ], 'a_frog, b25'.get_args
> end
> def test_embedded_parens
> assert_equal %w[ a(1) b ], 'a(1), b'.get_args
> assert_equal %w[ a b(i) ], 'a, b(i)'.get_args
> end
> def test_embedded_parens_with_commas
> assert_equal %w[ a(0,j) b ], 'a(0,j),b'.get_args
> assert_equal %w[ a() b(j,k) ], 'a(),b(j,k)'.get_args
> assert_equal %w[ c(i,j,t(1)) ], 'c(i,j,t(1))'.get_args
> end
> end
>
> Thanks,
> --
> Bil
> http://fun3d.lar...
>
>
>

--
View this message in context: http://www.nabble.com/argument-parsing-with-embedded-parentheses-tf1461223.htm...
Sent from the ruby-talk forum at Nabble.com.


5 Answers

Bil Kleb

8/24/2006 4:52:00 AM

0

QApassion wrote:
> Hi,

Hello.

> How about parsing a parameter list with embedded white space between two
> words and EOF?

Whoa.. I posted that one back in April?

Thanks though,
--
Bil
http://fun3d.lar...

anvil

10/2/2008 11:00:00 PM

0

Seth Hammond wrote:
> "anvil" <hammer@thor.em> wrote in message
> news:48e508fb$0$19556$7836cce5@newsrazor.net...
>> torresD wrote:
>>
>> "I like McCain's plain speaking way, to the point,
>> no punches pulled.
>>
>> I would trust McCain to do the right thing,
>> I think that he's a truthful person, with his heart in
>> the right place."
>
> You want four more years of dubya?

You do realize the two have very little in common and not much love lost.

Stop spreading propaganda, little man.

Phxbrd

10/2/2008 11:56:00 PM

0


"anvil" <hammer@thor.em> wrote in message
news:48e55cd5$0$19490$7836cce5@newsrazor.net...
> Seth Hammond wrote:
>> "anvil" <hammer@thor.em> wrote in message
>> news:48e508fb$0$19556$7836cce5@newsrazor.net...
>>> torresD wrote:
>>>
>>> "I like McCain's plain speaking way, to the point,
>>> no punches pulled.
>>>
>>> I would trust McCain to do the right thing,
>>> I think that he's a truthful person, with his heart in
>>> the right place."
>>
>> You want four more years of dubya?
>
> You do realize the two have very little in common and not much love lost.
>
> Stop spreading propaganda, little man.

Does stupidity run in your family, or have you developed yours all alone?
If so, you've done a mighty fine job.





Gilsonite

10/3/2008 12:50:00 AM

0

Seth Hammond wrote:
> "anvil" <hammer@thor.em> wrote in message
> news:48e55cd5$0$19490$7836cce5@newsrazor.net...
>> Seth Hammond wrote:
>>> "anvil" <hammer@thor.em> wrote in message
>>> news:48e508fb$0$19556$7836cce5@newsrazor.net...
>>>> torresD wrote:
>>>>
>>>> "I like McCain's plain speaking way, to the point,
>>>> no punches pulled.
>>>>
>>>> I would trust McCain to do the right thing,
>>>> I think that he's a truthful person, with his heart in
>>>> the right place."
>>> You want four more years of dubya?
>> You do realize the two have very little in common and not much love lost.
>>
>> Stop spreading propaganda, little man.
>
> Does stupidity run in your family,

No, that seem to be your issue.

Obwon

10/3/2008 5:45:00 AM

0

On Thu, 02 Oct 2008 11:46:23 -0600, anvil <hammer@thor.em>
wrote:

>torresD wrote:
>
>"I like McCain's plain speaking way, to the point,
>no punches pulled.
>
>I would trust McCain to do the right thing,
>I think that he's a truthful person, with his heart in
>the right place."

Wow, straight from Matawan State
Mental Heath Facility! When did they
authorize an internet connection for
the patients? I thought the state was
having budget difficulties.