require 'test/unit' require 'rockit/dparser' require 'minibasic/minibasic_grammar' class ATestSamplesMinibasic < Test::Unit::TestCase # Test the String regexp by itself since it is special StringTermGrammar = Rockit::DParser::Grammar.new do start :S, [["PRINT", :String, value(1)]] term :String, /"[^"]*"/ end def test_01_string_term parser = StringTermGrammar.new_parser value = parser.parse 'PRINT "a"' assert_equal('"a"', value) end MiniBasicParser = Samples::MiniBasicGrammar.new_parser end