How to initialize the object of expression?

I

iMelody Cn

Hi,

It has a lot of expressions in a file.

such as:
int_a = 5, str_b = "Hello"

I want to parse the expressions, so define the object of Parameter.

class Parameter
def initialize(name,value)
@name = name
@value = value
#@range = range
end
def to_s
"#@name = @value"
#"#@name = @value|#@value"
end
end

But,How to initialize the object of expression?

I only know one method:
1) find"="
2) read left/right string of "="
3) a=Parameter.new(left,right)

but it's not good. :-(
How to parse it? such as Parameter("ABC=5")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top