Sha256: ac64da23526107ae4a701b01e8a25af0081df22805853f8237baff3841a6e5bf

Contents?: true

Size: 1011 Bytes

Versions: 19

Compression:

Stored size: 1011 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

19 entries across 14 versions & 4 rubygems

Version Path
tdiary-5.2.0 vendor/bundle/ruby/2.7.0/gems/racc-1.5.2/test/testscanner.rb
tdiary-5.1.7 vendor/bundle/ruby/2.7.0/gems/racc-1.5.2/test/testscanner.rb
tdiary-5.1.7 vendor/bundle/ruby/3.0.0/gems/racc-1.5.2/test/testscanner.rb
rails_mini_profiler-0.2.0 vendor/bundle/ruby/3.0.0/gems/racc-1.5.2/test/testscanner.rb
mumukit-content-type-1.11.1 vendor/bundle/ruby/2.6.0/gems/racc-1.5.2/test/testscanner.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/racc-1.5.2/test/testscanner.rb
tdiary-5.1.6 vendor/bundle/ruby/3.0.0/gems/racc-1.5.2/test/testscanner.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/racc-1.5.2/test/testscanner.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/2.7.0/gems/racc-1.5.2/test/testscanner.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/racc-1.5.2/test/testscanner.rb
tdiary-5.1.5 vendor/bundle/ruby/2.7.0/gems/racc-1.5.2/test/testscanner.rb
racc-1.5.2-java test/testscanner.rb
racc-1.5.2 test/testscanner.rb
racc-1.5.1-java test/testscanner.rb
racc-1.5.1 test/testscanner.rb
racc-1.5.0-java test/testscanner.rb
racc-1.5.0 test/testscanner.rb
racc-1.4.16-java test/testscanner.rb
racc-1.4.16 test/testscanner.rb