Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 343354b702
Fetching contributors…

Cannot retrieve contributors at this time

20 lines (15 sloc) 0.325 kB
require 'abnf'
require 'pp'
rt = ABNF.regexp_tree(<<'End')
s0 = n0 s0 / n1 s2 / n2 s1 / ""
s1 = n0 s1 / n1 s0 / n2 s2
s2 = n0 s2 / n1 s1 / n2 s0
n0 = "0" / "3" / "6" / "9"
n1 = "1" / "4" / "7"
n2 = "2" / "5" / "8"
End
pp rt
r = rt.regexp(true)
1000.times {|i|
print "error: #{i}\n" unless (r !~ i.to_s) == (i%3 != 0)
}
Jump to Line
Something went wrong with that request. Please try again.