Permalink
Browse files

rather largish commit. Added specs, moved some things around, need to

do more cleanup.
  • Loading branch information...
1 parent b42d352 commit 44b006825ce0402a77282ed44c75b1561ebe9ce6 @mattknox committed Apr 23, 2010
Showing with 4,600 additions and 2 deletions.
  1. +1 −1 8ball.rb
  2. +24 −0 html/cgi-bin/compile_8ball.cgi
  3. +12 −0 html/cgi-bin/list_target.cgi
  4. +4,376 −0 html/js/jquery.js
  5. +6 −0 html/js/lib.js
  6. +60 −0 html/js/objects.js
  7. +5 −0 html/js/primitives.js
  8. +90 −0 html/snooker.html
  9. +5 −0 js/primitives.js
  10. +13 −0 spec/8ball_spec.rb
  11. +7 −0 spec/spec_helper.rb
  12. +1 −1 target/bm.rb
View
@@ -183,7 +183,7 @@ def self.compile_file(file_name)
prelude + compile_string(File.read(file_name))
end
- def prelude
+ def self.prelude
# this outputs the js runtime we need.
[File.read("lib.js"),
File.read("primitives.js")].join("\n")
@@ -0,0 +1,24 @@
+#!/usr/bin/env jruby
+
+require 'cgi'
+require '../8ball'
+
+cgi = CGI.new
+code = cgi['code']
+
+puts "Content-type: text/plain"
+puts ""
+
+class EightBallCompiler
+ def self.cs(ruby)
+ ast = parse(ruby)
+ puts ast.accept(EightBallVisitor.new)
+ end
+end
+
+begin
+ EightBallCompiler.cs(code)
+rescue => e
+ puts e.inspect
+ puts e.backtrace
+end
@@ -0,0 +1,12 @@
+#!/usr/bin/env jruby
+
+require 'cgi'
+
+cgi = CGI.new
+
+puts "Content-type: application/json"
+puts ""
+
+$stdout.write "["
+$stdout.write Dir["../target/*.rb"].map{|ea| "\"#{ea[3..-1]}\""}.join(", ")
+$stdout.puts "]"
Oops, something went wrong.

0 comments on commit 44b0068

Please sign in to comment.