Y
Young tae Kim
I can't understand why the following test fails.
Could you tell me why? Thanks, in advance.
# in arithmetic.treetop
grammar Arithmetic
rule white_space
[ \t\n\r]+ {
def value
text_value
end
}
end
end
# in test_parser.rb
require "rubygems"
require "treetop"
require "arithmetic"
parser = ArithmeticParser.new
p parser.parse(" \n\t\r")
# the execution result
$ ruby test_parser.rb
nil
Could you tell me why? Thanks, in advance.
# in arithmetic.treetop
grammar Arithmetic
rule white_space
[ \t\n\r]+ {
def value
text_value
end
}
end
end
# in test_parser.rb
require "rubygems"
require "treetop"
require "arithmetic"
parser = ArithmeticParser.new
p parser.parse(" \n\t\r")
# the execution result
$ ruby test_parser.rb
nil