Sha256: fd6f8bdba7b88f797e5a6e51d8819a10a7bbc72a86f9fe06a6e012d945fffed4

Contents?: true

Size: 1010 Bytes

Versions: 16

Compression:

Stored size: 1010 Bytes

Contents

#
# racc scanner tester
#

require 'racc/raccs'


class ScanError < StandardError; end

def testdata( dir, argv )
  if argv.empty? then
    Dir.glob( dir + '/*' ) -
    Dir.glob( dir + '/*.swp' ) -
    [ dir + '/CVS' ]
  else
    argv.collect {|i| dir + '/' + i }
  end
end


if ARGV.delete '--print' then
  $raccs_print_type = true
  printonly = true
else
  printonly = false
end

testdata( File.dirname($0) + '/scandata', ARGV ).each do |file|
  $stderr.print File.basename(file) + ': '
  begin
    ok = File.read(file)
    s = Racc::GrammarFileScanner.new( ok )
    sym, (val, lineno) = s.scan
    if printonly then
      $stderr.puts
      $stderr.puts val
      next
    end

    val = '{' + val + "}\n"
    sym == :ACTION  or raise ScanError, 'is not action!'
    val == ok       or raise ScanError, "\n>>>\n#{ok}----\n#{val}<<<"

    $stderr.puts 'ok'
  rescue => err
    $stderr.puts 'fail (' + err.type.to_s + ')'
    $stderr.puts err.message
    $stderr.puts err.backtrace
    $stderr.puts
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
racc-1.4.15-java test/testscanner.rb
racc-1.4.15 test/testscanner.rb
racc-1.4.14-java test/testscanner.rb
racc-1.4.14 test/testscanner.rb
racc-1.4.13-java test/testscanner.rb
racc-1.4.13 test/testscanner.rb
racc-1.4.12-java test/testscanner.rb
racc-1.4.12 test/testscanner.rb
racc-1.4.11 test/testscanner.rb
gd-racc-1.4.11 test/testscanner.rb
racc-1.4.10 test/testscanner.rb
racc-1.4.9-java test/testscanner.rb
racc-1.4.9 test/testscanner.rb
racc-1.4.8 test/testscanner.rb
racc-1.4.7 test/testscanner.rb
racc-1.4.6 test/testscanner.rb