1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/racc/assets/percent.y
2019-06-19 18:17:25 +09:00

35 lines
699 B
Text

class ScannerChecker
rule
target: A
{
i = 7
i %= 4
raise 'assert failed' unless i == 3
tmp = %-This is percent string.-
raise 'assert failed' unless tmp == 'This is percent string.'
a = 5; b = 3
assert_equal(2,(a%b)) #A
# assert_equal(2,(a %b)) # is %-string
assert_equal(2,(a% b)) #B
assert_equal(2,(a % b)) #C
}
end
---- inner ----
def parse
@q = [[:A, 'A'], [false, '$']]
do_parse
end
def next_token
@q.shift
end
def assert_equal( expect, real )
raise "expect #{expect.inspect} but #{real.inspect}" unless expect == real
end
---- footer ----
parser = ScannerChecker.new.parse