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")
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")