jbarnette-johnson 1.0.0.20081126120511 → 1.0.0.20090127202936

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/MANIFEST CHANGED
@@ -70,6 +70,7 @@ lib/johnson/visitors/dot_visitor.rb
70
70
  lib/johnson/visitors/ecma_visitor.rb
71
71
  lib/johnson/visitors/enumerating_visitor.rb
72
72
  lib/johnson/visitors/sexp_visitor.rb
73
+ lib/johnson/visitors/visitor.rb
73
74
  lib/rails/init.rb
74
75
  srcs/xmlparser-0.6.8.tar
75
76
  test/assets/index.html
@@ -283,7 +284,6 @@ vendor/spidermonkey/js.c
283
284
  vendor/spidermonkey/js.mak
284
285
  vendor/spidermonkey/js.mdp
285
286
  vendor/spidermonkey/js.msg
286
- vendor/spidermonkey/js.pkg
287
287
  vendor/spidermonkey/js3240.rc
288
288
  vendor/spidermonkey/jsOS240.def
289
289
  vendor/spidermonkey/jsapi.c
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require "erb"
3
3
  require "./lib/hoe.rb"
4
4
  require "./lib/johnson/version.rb"
5
5
 
6
- abort "Need Ruby version 1.8.6!" unless RUBY_VERSION == "1.8.6"
6
+ abort "Need Ruby version 1.8.x!" unless RUBY_VERSION > "1.8"
7
7
 
8
8
  # what sort of extension are we building?
9
9
  kind = Config::CONFIG["DLEXT"]
@@ -58,6 +58,14 @@ namespace :test do
58
58
  Johnson::Runtime.new.load(file)
59
59
  end
60
60
  end
61
+
62
+ task :jquery => :extensions do
63
+ $LOAD_PATH << File.expand_path(File.dirname(__FILE__) + "/lib")
64
+ $LOAD_PATH << File.expand_path(File.dirname(__FILE__) + "/../taka/lib")
65
+ Johnson.send(:remove_const, :VERSION)
66
+ require 'johnson'
67
+ Johnson::Runtime.new.load('test/jquery_units/test.js')
68
+ end
61
69
  end
62
70
 
63
71
  # make sure the C bits are up-to-date when testing
@@ -60,6 +60,34 @@ JSBool convert_to_js(JohnsonRuntime* runtime, VALUE ruby, jsval* retval)
60
60
  PREPARE_JROOTS(context, 0);
61
61
  switch(TYPE(ruby))
62
62
  {
63
+ case T_NONE:
64
+ JERROR("I don't know how to handle T_NONE.");
65
+ JRETURN;
66
+
67
+ case T_ICLASS:
68
+ JERROR("I don't know how to handle T_ICLASS.");
69
+ JRETURN;
70
+
71
+ case T_MATCH:
72
+ JERROR("I don't know how to handle T_MATCH.");
73
+ JRETURN;
74
+
75
+ case T_BLKTAG:
76
+ JERROR("I don't know how to handle T_BLKTAG.");
77
+ JRETURN;
78
+
79
+ case T_NODE:
80
+ JERROR("I don't know how to handle T_NODE | T_MASK.");
81
+ JRETURN;
82
+
83
+ case T_UNDEF:
84
+ JERROR("I don't know how to handle T_UNDEF.");
85
+ JRETURN;
86
+
87
+ case T_VARMAP:
88
+ JERROR("I don't know how to handle T_VARMAP.");
89
+ JRETURN;
90
+
63
91
  case T_NIL:
64
92
  *retval = JSVAL_NULL;
65
93
  JRETURN;
data/johnson.gemspec CHANGED
@@ -2,24 +2,24 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{johnson}
5
- s.version = "1.0.0.20081126120511"
5
+ s.version = "1.0.0.20090127202936"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["John Barnette", "Aaron Patterson", "Yehuda Katz", "Matthew Draper"]
9
- s.date = %q{2008-11-26}
9
+ s.date = %q{2009-01-27}
10
10
  s.default_executable = %q{johnson}
11
11
  s.description = %q{Johnson wraps JavaScript in a loving Ruby embrace.}
12
12
  s.email = %q{johnson-talk@googlegroups.com}
13
13
  s.executables = ["johnson"]
14
14
  s.extensions = ["Rakefile"]
15
15
  s.extra_rdoc_files = ["README.rdoc", "cross-compile.txt"]
16
- s.files = [".autotest", "CHANGELOG", "MANIFEST", "MINGW32.mk", "README.rdoc", "Rakefile", "bin/johnson", "cross-compile.txt", "ext/spidermonkey/context.c", "ext/spidermonkey/context.h", "ext/spidermonkey/conversions.c", "ext/spidermonkey/conversions.h", "ext/spidermonkey/debugger.c", "ext/spidermonkey/debugger.h", "ext/spidermonkey/extconf.rb", "ext/spidermonkey/extensions.c", "ext/spidermonkey/extensions.h", "ext/spidermonkey/global.c", "ext/spidermonkey/global.h", "ext/spidermonkey/idhash.c", "ext/spidermonkey/idhash.h", "ext/spidermonkey/immutable_node.c", "ext/spidermonkey/immutable_node.c.erb", "ext/spidermonkey/immutable_node.h", "ext/spidermonkey/jroot.h", "ext/spidermonkey/js_land_proxy.c", "ext/spidermonkey/js_land_proxy.h", "ext/spidermonkey/ruby_land_proxy.c", "ext/spidermonkey/ruby_land_proxy.h", "ext/spidermonkey/runtime.c", "ext/spidermonkey/runtime.h", "ext/spidermonkey/spidermonkey.c", "ext/spidermonkey/spidermonkey.h", "johnson.gemspec", "js/johnson/browser.js", "js/johnson/browser/env.js", "js/johnson/browser/jquery.js", "js/johnson/browser/xmlsax.js", "js/johnson/browser/xmlw3cdom.js", "js/johnson/cli.js", "js/johnson/prelude.js", "js/johnson/template.js", "lib/hoe.rb", "lib/johnson.rb", "lib/johnson/cli.rb", "lib/johnson/cli/options.rb", "lib/johnson/error.rb", "lib/johnson/nodes.rb", "lib/johnson/nodes/binary_node.rb", "lib/johnson/nodes/for.rb", "lib/johnson/nodes/for_in.rb", "lib/johnson/nodes/function.rb", "lib/johnson/nodes/list.rb", "lib/johnson/nodes/node.rb", "lib/johnson/nodes/ternary_node.rb", "lib/johnson/parser.rb", "lib/johnson/parser/syntax_error.rb", "lib/johnson/runtime.rb", "lib/johnson/spidermonkey/context.rb", "lib/johnson/spidermonkey/debugger.rb", "lib/johnson/spidermonkey/immutable_node.rb", "lib/johnson/spidermonkey/js_land_proxy.rb", "lib/johnson/spidermonkey/mutable_tree_visitor.rb", "lib/johnson/spidermonkey/ruby_land_proxy.rb", "lib/johnson/spidermonkey/runtime.rb", "lib/johnson/version.rb", "lib/johnson/visitable.rb", "lib/johnson/visitors.rb", "lib/johnson/visitors/dot_visitor.rb", "lib/johnson/visitors/ecma_visitor.rb", "lib/johnson/visitors/enumerating_visitor.rb", "lib/johnson/visitors/sexp_visitor.rb", "lib/rails/init.rb", "srcs/xmlparser-0.6.8.tar", "test/assets/index.html", "test/assets/jquery_test.html", "test/helper.rb", "test/johnson/browser_test.rb", "test/johnson/conversions/array_test.rb", "test/johnson/conversions/boolean_test.rb", "test/johnson/conversions/callable_test.rb", "test/johnson/conversions/file_test.rb", "test/johnson/conversions/nil_test.rb", "test/johnson/conversions/number_test.rb", "test/johnson/conversions/regexp_test.rb", "test/johnson/conversions/string_test.rb", "test/johnson/conversions/struct_test.rb", "test/johnson/conversions/symbol_test.rb", "test/johnson/conversions/thread_test.rb", "test/johnson/error_test.rb", "test/johnson/extensions_test.rb", "test/johnson/nodes/array_literal_test.rb", "test/johnson/nodes/array_node_test.rb", "test/johnson/nodes/binary_node_test.rb", "test/johnson/nodes/bracket_access_test.rb", "test/johnson/nodes/delete_test.rb", "test/johnson/nodes/do_while_test.rb", "test/johnson/nodes/dot_accessor_test.rb", "test/johnson/nodes/export_test.rb", "test/johnson/nodes/for_test.rb", "test/johnson/nodes/function_test.rb", "test/johnson/nodes/if_test.rb", "test/johnson/nodes/import_test.rb", "test/johnson/nodes/label_test.rb", "test/johnson/nodes/let_test.rb", "test/johnson/nodes/object_literal_test.rb", "test/johnson/nodes/return_test.rb", "test/johnson/nodes/semi_test.rb", "test/johnson/nodes/switch_test.rb", "test/johnson/nodes/ternary_test.rb", "test/johnson/nodes/throw_test.rb", "test/johnson/nodes/try_node_test.rb", "test/johnson/nodes/typeof_test.rb", "test/johnson/nodes/unary_node_test.rb", "test/johnson/nodes/void_test.rb", "test/johnson/nodes/while_test.rb", "test/johnson/nodes/with_test.rb", "test/johnson/prelude_test.rb", "test/johnson/runtime_test.rb", "test/johnson/spidermonkey/context_test.rb", "test/johnson/spidermonkey/immutable_node_test.rb", "test/johnson/spidermonkey/js_land_proxy_test.rb", "test/johnson/spidermonkey/ruby_land_proxy_test.rb", "test/johnson/spidermonkey/runtime_test.rb", "test/johnson/version_test.rb", "test/johnson/visitors/dot_visitor_test.rb", "test/johnson/visitors/enumerating_visitor_test.rb", "test/johnson_test.rb", "test/jquery_units/simple.js", "test/jquery_units/test.js", "test/jquery_units/test_helper.js", "test/jquery_units/units/ajax.js", "test/jquery_units/units/core.js", "test/jquery_units/units/event.js", "test/jquery_units/units/fx.js", "test/jquery_units/units/offset.js", "test/jquery_units/units/selector.js", "test/jspec/helper.js", "test/jspec/jspec.js", "test/jspec/simple_spec.js", "test/parser_test.rb", "todo/.keep", "vendor/spidermonkey/.cvsignore", "vendor/spidermonkey/Makefile.in", "vendor/spidermonkey/Makefile.ref", "vendor/spidermonkey/README.html", "vendor/spidermonkey/SpiderMonkey.rsp", "vendor/spidermonkey/Y.js", "vendor/spidermonkey/build.mk", "vendor/spidermonkey/config.mk", "vendor/spidermonkey/config/AIX4.1.mk", "vendor/spidermonkey/config/AIX4.2.mk", "vendor/spidermonkey/config/AIX4.3.mk", "vendor/spidermonkey/config/Darwin.mk", "vendor/spidermonkey/config/Darwin1.3.mk", "vendor/spidermonkey/config/Darwin1.4.mk", "vendor/spidermonkey/config/Darwin5.2.mk", "vendor/spidermonkey/config/Darwin5.3.mk", "vendor/spidermonkey/config/HP-UXB.10.10.mk", "vendor/spidermonkey/config/HP-UXB.10.20.mk", "vendor/spidermonkey/config/HP-UXB.11.00.mk", "vendor/spidermonkey/config/IRIX.mk", "vendor/spidermonkey/config/IRIX5.3.mk", "vendor/spidermonkey/config/IRIX6.1.mk", "vendor/spidermonkey/config/IRIX6.2.mk", "vendor/spidermonkey/config/IRIX6.3.mk", "vendor/spidermonkey/config/IRIX6.5.mk", "vendor/spidermonkey/config/Linux_All.mk", "vendor/spidermonkey/config/Mac_OS10.0.mk", "vendor/spidermonkey/config/OSF1V4.0.mk", "vendor/spidermonkey/config/OSF1V5.0.mk", "vendor/spidermonkey/config/SunOS4.1.4.mk", "vendor/spidermonkey/config/SunOS5.10.mk", "vendor/spidermonkey/config/SunOS5.3.mk", "vendor/spidermonkey/config/SunOS5.4.mk", "vendor/spidermonkey/config/SunOS5.5.1.mk", "vendor/spidermonkey/config/SunOS5.5.mk", "vendor/spidermonkey/config/SunOS5.6.mk", "vendor/spidermonkey/config/SunOS5.7.mk", "vendor/spidermonkey/config/SunOS5.8.mk", "vendor/spidermonkey/config/SunOS5.9.mk", "vendor/spidermonkey/config/WINNT4.0.mk", "vendor/spidermonkey/config/WINNT5.0.mk", "vendor/spidermonkey/config/WINNT5.1.mk", "vendor/spidermonkey/config/WINNT5.2.mk", "vendor/spidermonkey/config/WINNT6.0.mk", "vendor/spidermonkey/config/dgux.mk", "vendor/spidermonkey/editline/Makefile.ref", "vendor/spidermonkey/editline/README", "vendor/spidermonkey/editline/editline.3", "vendor/spidermonkey/editline/editline.c", "vendor/spidermonkey/editline/editline.h", "vendor/spidermonkey/editline/sysunix.c", "vendor/spidermonkey/editline/unix.h", "vendor/spidermonkey/fdlibm/.cvsignore", "vendor/spidermonkey/fdlibm/Makefile.in", "vendor/spidermonkey/fdlibm/Makefile.ref", "vendor/spidermonkey/fdlibm/e_acos.c", "vendor/spidermonkey/fdlibm/e_acosh.c", "vendor/spidermonkey/fdlibm/e_asin.c", "vendor/spidermonkey/fdlibm/e_atan2.c", "vendor/spidermonkey/fdlibm/e_atanh.c", "vendor/spidermonkey/fdlibm/e_cosh.c", "vendor/spidermonkey/fdlibm/e_exp.c", "vendor/spidermonkey/fdlibm/e_fmod.c", "vendor/spidermonkey/fdlibm/e_gamma.c", "vendor/spidermonkey/fdlibm/e_gamma_r.c", "vendor/spidermonkey/fdlibm/e_hypot.c", "vendor/spidermonkey/fdlibm/e_j0.c", "vendor/spidermonkey/fdlibm/e_j1.c", "vendor/spidermonkey/fdlibm/e_jn.c", "vendor/spidermonkey/fdlibm/e_lgamma.c", "vendor/spidermonkey/fdlibm/e_lgamma_r.c", "vendor/spidermonkey/fdlibm/e_log.c", "vendor/spidermonkey/fdlibm/e_log10.c", "vendor/spidermonkey/fdlibm/e_pow.c", "vendor/spidermonkey/fdlibm/e_rem_pio2.c", "vendor/spidermonkey/fdlibm/e_remainder.c", "vendor/spidermonkey/fdlibm/e_scalb.c", "vendor/spidermonkey/fdlibm/e_sinh.c", "vendor/spidermonkey/fdlibm/e_sqrt.c", "vendor/spidermonkey/fdlibm/fdlibm.h", "vendor/spidermonkey/fdlibm/fdlibm.mak", "vendor/spidermonkey/fdlibm/fdlibm.mdp", "vendor/spidermonkey/fdlibm/k_cos.c", "vendor/spidermonkey/fdlibm/k_rem_pio2.c", "vendor/spidermonkey/fdlibm/k_sin.c", "vendor/spidermonkey/fdlibm/k_standard.c", "vendor/spidermonkey/fdlibm/k_tan.c", "vendor/spidermonkey/fdlibm/s_asinh.c", "vendor/spidermonkey/fdlibm/s_atan.c", "vendor/spidermonkey/fdlibm/s_cbrt.c", "vendor/spidermonkey/fdlibm/s_ceil.c", "vendor/spidermonkey/fdlibm/s_copysign.c", "vendor/spidermonkey/fdlibm/s_cos.c", "vendor/spidermonkey/fdlibm/s_erf.c", "vendor/spidermonkey/fdlibm/s_expm1.c", "vendor/spidermonkey/fdlibm/s_fabs.c", "vendor/spidermonkey/fdlibm/s_finite.c", "vendor/spidermonkey/fdlibm/s_floor.c", "vendor/spidermonkey/fdlibm/s_frexp.c", "vendor/spidermonkey/fdlibm/s_ilogb.c", "vendor/spidermonkey/fdlibm/s_isnan.c", "vendor/spidermonkey/fdlibm/s_ldexp.c", "vendor/spidermonkey/fdlibm/s_lib_version.c", "vendor/spidermonkey/fdlibm/s_log1p.c", "vendor/spidermonkey/fdlibm/s_logb.c", "vendor/spidermonkey/fdlibm/s_matherr.c", "vendor/spidermonkey/fdlibm/s_modf.c", "vendor/spidermonkey/fdlibm/s_nextafter.c", "vendor/spidermonkey/fdlibm/s_rint.c", "vendor/spidermonkey/fdlibm/s_scalbn.c", "vendor/spidermonkey/fdlibm/s_signgam.c", "vendor/spidermonkey/fdlibm/s_significand.c", "vendor/spidermonkey/fdlibm/s_sin.c", "vendor/spidermonkey/fdlibm/s_tan.c", "vendor/spidermonkey/fdlibm/s_tanh.c", "vendor/spidermonkey/fdlibm/w_acos.c", "vendor/spidermonkey/fdlibm/w_acosh.c", "vendor/spidermonkey/fdlibm/w_asin.c", "vendor/spidermonkey/fdlibm/w_atan2.c", "vendor/spidermonkey/fdlibm/w_atanh.c", "vendor/spidermonkey/fdlibm/w_cosh.c", "vendor/spidermonkey/fdlibm/w_exp.c", "vendor/spidermonkey/fdlibm/w_fmod.c", "vendor/spidermonkey/fdlibm/w_gamma.c", "vendor/spidermonkey/fdlibm/w_gamma_r.c", "vendor/spidermonkey/fdlibm/w_hypot.c", "vendor/spidermonkey/fdlibm/w_j0.c", "vendor/spidermonkey/fdlibm/w_j1.c", "vendor/spidermonkey/fdlibm/w_jn.c", "vendor/spidermonkey/fdlibm/w_lgamma.c", "vendor/spidermonkey/fdlibm/w_lgamma_r.c", "vendor/spidermonkey/fdlibm/w_log.c", "vendor/spidermonkey/fdlibm/w_log10.c", "vendor/spidermonkey/fdlibm/w_pow.c", "vendor/spidermonkey/fdlibm/w_remainder.c", "vendor/spidermonkey/fdlibm/w_scalb.c", "vendor/spidermonkey/fdlibm/w_sinh.c", "vendor/spidermonkey/fdlibm/w_sqrt.c", "vendor/spidermonkey/javascript-trace.d", "vendor/spidermonkey/js.c", "vendor/spidermonkey/js.mak", "vendor/spidermonkey/js.mdp", "vendor/spidermonkey/js.msg", "vendor/spidermonkey/js3240.rc", "vendor/spidermonkey/jsOS240.def", "vendor/spidermonkey/jsapi.c", "vendor/spidermonkey/jsapi.h", "vendor/spidermonkey/jsarena.c", "vendor/spidermonkey/jsarena.h", "vendor/spidermonkey/jsarray.c", "vendor/spidermonkey/jsarray.h", "vendor/spidermonkey/jsatom.c", "vendor/spidermonkey/jsatom.h", "vendor/spidermonkey/jsbit.h", "vendor/spidermonkey/jsbool.c", "vendor/spidermonkey/jsbool.h", "vendor/spidermonkey/jsclist.h", "vendor/spidermonkey/jscntxt.c", "vendor/spidermonkey/jscntxt.h", "vendor/spidermonkey/jscompat.h", "vendor/spidermonkey/jsconfig.h", "vendor/spidermonkey/jsconfig.mk", "vendor/spidermonkey/jscpucfg.c", "vendor/spidermonkey/jscpucfg.h", "vendor/spidermonkey/jsdate.c", "vendor/spidermonkey/jsdate.h", "vendor/spidermonkey/jsdbgapi.c", "vendor/spidermonkey/jsdbgapi.h", "vendor/spidermonkey/jsdhash.c", "vendor/spidermonkey/jsdhash.h", "vendor/spidermonkey/jsdtoa.c", "vendor/spidermonkey/jsdtoa.h", "vendor/spidermonkey/jsdtracef.c", "vendor/spidermonkey/jsdtracef.h", "vendor/spidermonkey/jsemit.c", "vendor/spidermonkey/jsemit.h", "vendor/spidermonkey/jsexn.c", "vendor/spidermonkey/jsexn.h", "vendor/spidermonkey/jsfile.c", "vendor/spidermonkey/jsfile.h", "vendor/spidermonkey/jsfile.msg", "vendor/spidermonkey/jsfun.c", "vendor/spidermonkey/jsfun.h", "vendor/spidermonkey/jsgc.c", "vendor/spidermonkey/jsgc.h", "vendor/spidermonkey/jshash.c", "vendor/spidermonkey/jshash.h", "vendor/spidermonkey/jsify.pl", "vendor/spidermonkey/jsinterp.c", "vendor/spidermonkey/jsinterp.h", "vendor/spidermonkey/jsinvoke.c", "vendor/spidermonkey/jsiter.c", "vendor/spidermonkey/jsiter.h", "vendor/spidermonkey/jskeyword.tbl", "vendor/spidermonkey/jskwgen.c", "vendor/spidermonkey/jslibmath.h", "vendor/spidermonkey/jslock.c", "vendor/spidermonkey/jslock.h", "vendor/spidermonkey/jslocko.asm", "vendor/spidermonkey/jslog2.c", "vendor/spidermonkey/jslong.c", "vendor/spidermonkey/jslong.h", "vendor/spidermonkey/jsmath.c", "vendor/spidermonkey/jsmath.h", "vendor/spidermonkey/jsnum.c", "vendor/spidermonkey/jsnum.h", "vendor/spidermonkey/jsobj.c", "vendor/spidermonkey/jsobj.h", "vendor/spidermonkey/jsopcode.c", "vendor/spidermonkey/jsopcode.h", "vendor/spidermonkey/jsopcode.tbl", "vendor/spidermonkey/jsotypes.h", "vendor/spidermonkey/jsparse.c", "vendor/spidermonkey/jsparse.h", "vendor/spidermonkey/jsprf.c", "vendor/spidermonkey/jsprf.h", "vendor/spidermonkey/jsproto.tbl", "vendor/spidermonkey/jsprvtd.h", "vendor/spidermonkey/jspubtd.h", "vendor/spidermonkey/jsregexp.c", "vendor/spidermonkey/jsregexp.h", "vendor/spidermonkey/jsreops.tbl", "vendor/spidermonkey/jsscan.c", "vendor/spidermonkey/jsscan.h", "vendor/spidermonkey/jsscope.c", "vendor/spidermonkey/jsscope.h", "vendor/spidermonkey/jsscript.c", "vendor/spidermonkey/jsscript.h", "vendor/spidermonkey/jsshell.msg", "vendor/spidermonkey/jsstddef.h", "vendor/spidermonkey/jsstr.c", "vendor/spidermonkey/jsstr.h", "vendor/spidermonkey/jstypes.h", "vendor/spidermonkey/jsutil.c", "vendor/spidermonkey/jsutil.h", "vendor/spidermonkey/jsxdrapi.c", "vendor/spidermonkey/jsxdrapi.h", "vendor/spidermonkey/jsxml.c", "vendor/spidermonkey/jsxml.h", "vendor/spidermonkey/lock_SunOS.s", "vendor/spidermonkey/perfect.js", "vendor/spidermonkey/plify_jsdhash.sed", "vendor/spidermonkey/prmjtime.c", "vendor/spidermonkey/prmjtime.h", "vendor/spidermonkey/resource.h", "vendor/spidermonkey/rules.mk", "vendor/spidermonkey/win32.order"]
16
+ s.files = [".autotest", "CHANGELOG", "MANIFEST", "MINGW32.mk", "README.rdoc", "Rakefile", "bin/johnson", "cross-compile.txt", "ext/spidermonkey/context.c", "ext/spidermonkey/context.h", "ext/spidermonkey/conversions.c", "ext/spidermonkey/conversions.h", "ext/spidermonkey/debugger.c", "ext/spidermonkey/debugger.h", "ext/spidermonkey/extconf.rb", "ext/spidermonkey/extensions.c", "ext/spidermonkey/extensions.h", "ext/spidermonkey/global.c", "ext/spidermonkey/global.h", "ext/spidermonkey/idhash.c", "ext/spidermonkey/idhash.h", "ext/spidermonkey/immutable_node.c", "ext/spidermonkey/immutable_node.c.erb", "ext/spidermonkey/immutable_node.h", "ext/spidermonkey/jroot.h", "ext/spidermonkey/js_land_proxy.c", "ext/spidermonkey/js_land_proxy.h", "ext/spidermonkey/ruby_land_proxy.c", "ext/spidermonkey/ruby_land_proxy.h", "ext/spidermonkey/runtime.c", "ext/spidermonkey/runtime.h", "ext/spidermonkey/spidermonkey.c", "ext/spidermonkey/spidermonkey.h", "johnson.gemspec", "js/johnson/browser.js", "js/johnson/browser/env.js", "js/johnson/browser/jquery.js", "js/johnson/browser/xmlsax.js", "js/johnson/browser/xmlw3cdom.js", "js/johnson/cli.js", "js/johnson/prelude.js", "js/johnson/template.js", "lib/hoe.rb", "lib/johnson.rb", "lib/johnson/cli.rb", "lib/johnson/cli/options.rb", "lib/johnson/error.rb", "lib/johnson/nodes.rb", "lib/johnson/nodes/binary_node.rb", "lib/johnson/nodes/for.rb", "lib/johnson/nodes/for_in.rb", "lib/johnson/nodes/function.rb", "lib/johnson/nodes/list.rb", "lib/johnson/nodes/node.rb", "lib/johnson/nodes/ternary_node.rb", "lib/johnson/parser.rb", "lib/johnson/parser/syntax_error.rb", "lib/johnson/runtime.rb", "lib/johnson/spidermonkey/context.rb", "lib/johnson/spidermonkey/debugger.rb", "lib/johnson/spidermonkey/immutable_node.rb", "lib/johnson/spidermonkey/js_land_proxy.rb", "lib/johnson/spidermonkey/mutable_tree_visitor.rb", "lib/johnson/spidermonkey/ruby_land_proxy.rb", "lib/johnson/spidermonkey/runtime.rb", "lib/johnson/version.rb", "lib/johnson/visitable.rb", "lib/johnson/visitors.rb", "lib/johnson/visitors/dot_visitor.rb", "lib/johnson/visitors/ecma_visitor.rb", "lib/johnson/visitors/enumerating_visitor.rb", "lib/johnson/visitors/sexp_visitor.rb", "lib/johnson/visitors/visitor.rb", "lib/rails/init.rb", "srcs/xmlparser-0.6.8.tar", "test/assets/index.html", "test/assets/jquery_test.html", "test/helper.rb", "test/johnson/browser_test.rb", "test/johnson/conversions/array_test.rb", "test/johnson/conversions/boolean_test.rb", "test/johnson/conversions/callable_test.rb", "test/johnson/conversions/file_test.rb", "test/johnson/conversions/nil_test.rb", "test/johnson/conversions/number_test.rb", "test/johnson/conversions/regexp_test.rb", "test/johnson/conversions/string_test.rb", "test/johnson/conversions/struct_test.rb", "test/johnson/conversions/symbol_test.rb", "test/johnson/conversions/thread_test.rb", "test/johnson/error_test.rb", "test/johnson/extensions_test.rb", "test/johnson/nodes/array_literal_test.rb", "test/johnson/nodes/array_node_test.rb", "test/johnson/nodes/binary_node_test.rb", "test/johnson/nodes/bracket_access_test.rb", "test/johnson/nodes/delete_test.rb", "test/johnson/nodes/do_while_test.rb", "test/johnson/nodes/dot_accessor_test.rb", "test/johnson/nodes/export_test.rb", "test/johnson/nodes/for_test.rb", "test/johnson/nodes/function_test.rb", "test/johnson/nodes/if_test.rb", "test/johnson/nodes/import_test.rb", "test/johnson/nodes/label_test.rb", "test/johnson/nodes/let_test.rb", "test/johnson/nodes/object_literal_test.rb", "test/johnson/nodes/return_test.rb", "test/johnson/nodes/semi_test.rb", "test/johnson/nodes/switch_test.rb", "test/johnson/nodes/ternary_test.rb", "test/johnson/nodes/throw_test.rb", "test/johnson/nodes/try_node_test.rb", "test/johnson/nodes/typeof_test.rb", "test/johnson/nodes/unary_node_test.rb", "test/johnson/nodes/void_test.rb", "test/johnson/nodes/while_test.rb", "test/johnson/nodes/with_test.rb", "test/johnson/prelude_test.rb", "test/johnson/runtime_test.rb", "test/johnson/spidermonkey/context_test.rb", "test/johnson/spidermonkey/immutable_node_test.rb", "test/johnson/spidermonkey/js_land_proxy_test.rb", "test/johnson/spidermonkey/ruby_land_proxy_test.rb", "test/johnson/spidermonkey/runtime_test.rb", "test/johnson/version_test.rb", "test/johnson/visitors/dot_visitor_test.rb", "test/johnson/visitors/enumerating_visitor_test.rb", "test/johnson_test.rb", "test/jquery_units/simple.js", "test/jquery_units/test.js", "test/jquery_units/test_helper.js", "test/jquery_units/units/ajax.js", "test/jquery_units/units/core.js", "test/jquery_units/units/event.js", "test/jquery_units/units/fx.js", "test/jquery_units/units/offset.js", "test/jquery_units/units/selector.js", "test/jspec/helper.js", "test/jspec/jspec.js", "test/jspec/simple_spec.js", "test/parser_test.rb", "todo/.keep", "vendor/spidermonkey/.cvsignore", "vendor/spidermonkey/Makefile.in", "vendor/spidermonkey/Makefile.ref", "vendor/spidermonkey/README.html", "vendor/spidermonkey/SpiderMonkey.rsp", "vendor/spidermonkey/Y.js", "vendor/spidermonkey/build.mk", "vendor/spidermonkey/config.mk", "vendor/spidermonkey/config/AIX4.1.mk", "vendor/spidermonkey/config/AIX4.2.mk", "vendor/spidermonkey/config/AIX4.3.mk", "vendor/spidermonkey/config/Darwin.mk", "vendor/spidermonkey/config/Darwin1.3.mk", "vendor/spidermonkey/config/Darwin1.4.mk", "vendor/spidermonkey/config/Darwin5.2.mk", "vendor/spidermonkey/config/Darwin5.3.mk", "vendor/spidermonkey/config/HP-UXB.10.10.mk", "vendor/spidermonkey/config/HP-UXB.10.20.mk", "vendor/spidermonkey/config/HP-UXB.11.00.mk", "vendor/spidermonkey/config/IRIX.mk", "vendor/spidermonkey/config/IRIX5.3.mk", "vendor/spidermonkey/config/IRIX6.1.mk", "vendor/spidermonkey/config/IRIX6.2.mk", "vendor/spidermonkey/config/IRIX6.3.mk", "vendor/spidermonkey/config/IRIX6.5.mk", "vendor/spidermonkey/config/Linux_All.mk", "vendor/spidermonkey/config/Mac_OS10.0.mk", "vendor/spidermonkey/config/OSF1V4.0.mk", "vendor/spidermonkey/config/OSF1V5.0.mk", "vendor/spidermonkey/config/SunOS4.1.4.mk", "vendor/spidermonkey/config/SunOS5.10.mk", "vendor/spidermonkey/config/SunOS5.3.mk", "vendor/spidermonkey/config/SunOS5.4.mk", "vendor/spidermonkey/config/SunOS5.5.1.mk", "vendor/spidermonkey/config/SunOS5.5.mk", "vendor/spidermonkey/config/SunOS5.6.mk", "vendor/spidermonkey/config/SunOS5.7.mk", "vendor/spidermonkey/config/SunOS5.8.mk", "vendor/spidermonkey/config/SunOS5.9.mk", "vendor/spidermonkey/config/WINNT4.0.mk", "vendor/spidermonkey/config/WINNT5.0.mk", "vendor/spidermonkey/config/WINNT5.1.mk", "vendor/spidermonkey/config/WINNT5.2.mk", "vendor/spidermonkey/config/WINNT6.0.mk", "vendor/spidermonkey/config/dgux.mk", "vendor/spidermonkey/editline/Makefile.ref", "vendor/spidermonkey/editline/README", "vendor/spidermonkey/editline/editline.3", "vendor/spidermonkey/editline/editline.c", "vendor/spidermonkey/editline/editline.h", "vendor/spidermonkey/editline/sysunix.c", "vendor/spidermonkey/editline/unix.h", "vendor/spidermonkey/fdlibm/.cvsignore", "vendor/spidermonkey/fdlibm/Makefile.in", "vendor/spidermonkey/fdlibm/Makefile.ref", "vendor/spidermonkey/fdlibm/e_acos.c", "vendor/spidermonkey/fdlibm/e_acosh.c", "vendor/spidermonkey/fdlibm/e_asin.c", "vendor/spidermonkey/fdlibm/e_atan2.c", "vendor/spidermonkey/fdlibm/e_atanh.c", "vendor/spidermonkey/fdlibm/e_cosh.c", "vendor/spidermonkey/fdlibm/e_exp.c", "vendor/spidermonkey/fdlibm/e_fmod.c", "vendor/spidermonkey/fdlibm/e_gamma.c", "vendor/spidermonkey/fdlibm/e_gamma_r.c", "vendor/spidermonkey/fdlibm/e_hypot.c", "vendor/spidermonkey/fdlibm/e_j0.c", "vendor/spidermonkey/fdlibm/e_j1.c", "vendor/spidermonkey/fdlibm/e_jn.c", "vendor/spidermonkey/fdlibm/e_lgamma.c", "vendor/spidermonkey/fdlibm/e_lgamma_r.c", "vendor/spidermonkey/fdlibm/e_log.c", "vendor/spidermonkey/fdlibm/e_log10.c", "vendor/spidermonkey/fdlibm/e_pow.c", "vendor/spidermonkey/fdlibm/e_rem_pio2.c", "vendor/spidermonkey/fdlibm/e_remainder.c", "vendor/spidermonkey/fdlibm/e_scalb.c", "vendor/spidermonkey/fdlibm/e_sinh.c", "vendor/spidermonkey/fdlibm/e_sqrt.c", "vendor/spidermonkey/fdlibm/fdlibm.h", "vendor/spidermonkey/fdlibm/fdlibm.mak", "vendor/spidermonkey/fdlibm/fdlibm.mdp", "vendor/spidermonkey/fdlibm/k_cos.c", "vendor/spidermonkey/fdlibm/k_rem_pio2.c", "vendor/spidermonkey/fdlibm/k_sin.c", "vendor/spidermonkey/fdlibm/k_standard.c", "vendor/spidermonkey/fdlibm/k_tan.c", "vendor/spidermonkey/fdlibm/s_asinh.c", "vendor/spidermonkey/fdlibm/s_atan.c", "vendor/spidermonkey/fdlibm/s_cbrt.c", "vendor/spidermonkey/fdlibm/s_ceil.c", "vendor/spidermonkey/fdlibm/s_copysign.c", "vendor/spidermonkey/fdlibm/s_cos.c", "vendor/spidermonkey/fdlibm/s_erf.c", "vendor/spidermonkey/fdlibm/s_expm1.c", "vendor/spidermonkey/fdlibm/s_fabs.c", "vendor/spidermonkey/fdlibm/s_finite.c", "vendor/spidermonkey/fdlibm/s_floor.c", "vendor/spidermonkey/fdlibm/s_frexp.c", "vendor/spidermonkey/fdlibm/s_ilogb.c", "vendor/spidermonkey/fdlibm/s_isnan.c", "vendor/spidermonkey/fdlibm/s_ldexp.c", "vendor/spidermonkey/fdlibm/s_lib_version.c", "vendor/spidermonkey/fdlibm/s_log1p.c", "vendor/spidermonkey/fdlibm/s_logb.c", "vendor/spidermonkey/fdlibm/s_matherr.c", "vendor/spidermonkey/fdlibm/s_modf.c", "vendor/spidermonkey/fdlibm/s_nextafter.c", "vendor/spidermonkey/fdlibm/s_rint.c", "vendor/spidermonkey/fdlibm/s_scalbn.c", "vendor/spidermonkey/fdlibm/s_signgam.c", "vendor/spidermonkey/fdlibm/s_significand.c", "vendor/spidermonkey/fdlibm/s_sin.c", "vendor/spidermonkey/fdlibm/s_tan.c", "vendor/spidermonkey/fdlibm/s_tanh.c", "vendor/spidermonkey/fdlibm/w_acos.c", "vendor/spidermonkey/fdlibm/w_acosh.c", "vendor/spidermonkey/fdlibm/w_asin.c", "vendor/spidermonkey/fdlibm/w_atan2.c", "vendor/spidermonkey/fdlibm/w_atanh.c", "vendor/spidermonkey/fdlibm/w_cosh.c", "vendor/spidermonkey/fdlibm/w_exp.c", "vendor/spidermonkey/fdlibm/w_fmod.c", "vendor/spidermonkey/fdlibm/w_gamma.c", "vendor/spidermonkey/fdlibm/w_gamma_r.c", "vendor/spidermonkey/fdlibm/w_hypot.c", "vendor/spidermonkey/fdlibm/w_j0.c", "vendor/spidermonkey/fdlibm/w_j1.c", "vendor/spidermonkey/fdlibm/w_jn.c", "vendor/spidermonkey/fdlibm/w_lgamma.c", "vendor/spidermonkey/fdlibm/w_lgamma_r.c", "vendor/spidermonkey/fdlibm/w_log.c", "vendor/spidermonkey/fdlibm/w_log10.c", "vendor/spidermonkey/fdlibm/w_pow.c", "vendor/spidermonkey/fdlibm/w_remainder.c", "vendor/spidermonkey/fdlibm/w_scalb.c", "vendor/spidermonkey/fdlibm/w_sinh.c", "vendor/spidermonkey/fdlibm/w_sqrt.c", "vendor/spidermonkey/javascript-trace.d", "vendor/spidermonkey/js.c", "vendor/spidermonkey/js.mak", "vendor/spidermonkey/js.mdp", "vendor/spidermonkey/js.msg", "vendor/spidermonkey/js3240.rc", "vendor/spidermonkey/jsOS240.def", "vendor/spidermonkey/jsapi.c", "vendor/spidermonkey/jsapi.h", "vendor/spidermonkey/jsarena.c", "vendor/spidermonkey/jsarena.h", "vendor/spidermonkey/jsarray.c", "vendor/spidermonkey/jsarray.h", "vendor/spidermonkey/jsatom.c", "vendor/spidermonkey/jsatom.h", "vendor/spidermonkey/jsbit.h", "vendor/spidermonkey/jsbool.c", "vendor/spidermonkey/jsbool.h", "vendor/spidermonkey/jsclist.h", "vendor/spidermonkey/jscntxt.c", "vendor/spidermonkey/jscntxt.h", "vendor/spidermonkey/jscompat.h", "vendor/spidermonkey/jsconfig.h", "vendor/spidermonkey/jsconfig.mk", "vendor/spidermonkey/jscpucfg.c", "vendor/spidermonkey/jscpucfg.h", "vendor/spidermonkey/jsdate.c", "vendor/spidermonkey/jsdate.h", "vendor/spidermonkey/jsdbgapi.c", "vendor/spidermonkey/jsdbgapi.h", "vendor/spidermonkey/jsdhash.c", "vendor/spidermonkey/jsdhash.h", "vendor/spidermonkey/jsdtoa.c", "vendor/spidermonkey/jsdtoa.h", "vendor/spidermonkey/jsdtracef.c", "vendor/spidermonkey/jsdtracef.h", "vendor/spidermonkey/jsemit.c", "vendor/spidermonkey/jsemit.h", "vendor/spidermonkey/jsexn.c", "vendor/spidermonkey/jsexn.h", "vendor/spidermonkey/jsfile.c", "vendor/spidermonkey/jsfile.h", "vendor/spidermonkey/jsfile.msg", "vendor/spidermonkey/jsfun.c", "vendor/spidermonkey/jsfun.h", "vendor/spidermonkey/jsgc.c", "vendor/spidermonkey/jsgc.h", "vendor/spidermonkey/jshash.c", "vendor/spidermonkey/jshash.h", "vendor/spidermonkey/jsify.pl", "vendor/spidermonkey/jsinterp.c", "vendor/spidermonkey/jsinterp.h", "vendor/spidermonkey/jsinvoke.c", "vendor/spidermonkey/jsiter.c", "vendor/spidermonkey/jsiter.h", "vendor/spidermonkey/jskeyword.tbl", "vendor/spidermonkey/jskwgen.c", "vendor/spidermonkey/jslibmath.h", "vendor/spidermonkey/jslock.c", "vendor/spidermonkey/jslock.h", "vendor/spidermonkey/jslocko.asm", "vendor/spidermonkey/jslog2.c", "vendor/spidermonkey/jslong.c", "vendor/spidermonkey/jslong.h", "vendor/spidermonkey/jsmath.c", "vendor/spidermonkey/jsmath.h", "vendor/spidermonkey/jsnum.c", "vendor/spidermonkey/jsnum.h", "vendor/spidermonkey/jsobj.c", "vendor/spidermonkey/jsobj.h", "vendor/spidermonkey/jsopcode.c", "vendor/spidermonkey/jsopcode.h", "vendor/spidermonkey/jsopcode.tbl", "vendor/spidermonkey/jsotypes.h", "vendor/spidermonkey/jsparse.c", "vendor/spidermonkey/jsparse.h", "vendor/spidermonkey/jsprf.c", "vendor/spidermonkey/jsprf.h", "vendor/spidermonkey/jsproto.tbl", "vendor/spidermonkey/jsprvtd.h", "vendor/spidermonkey/jspubtd.h", "vendor/spidermonkey/jsregexp.c", "vendor/spidermonkey/jsregexp.h", "vendor/spidermonkey/jsreops.tbl", "vendor/spidermonkey/jsscan.c", "vendor/spidermonkey/jsscan.h", "vendor/spidermonkey/jsscope.c", "vendor/spidermonkey/jsscope.h", "vendor/spidermonkey/jsscript.c", "vendor/spidermonkey/jsscript.h", "vendor/spidermonkey/jsshell.msg", "vendor/spidermonkey/jsstddef.h", "vendor/spidermonkey/jsstr.c", "vendor/spidermonkey/jsstr.h", "vendor/spidermonkey/jstypes.h", "vendor/spidermonkey/jsutil.c", "vendor/spidermonkey/jsutil.h", "vendor/spidermonkey/jsxdrapi.c", "vendor/spidermonkey/jsxdrapi.h", "vendor/spidermonkey/jsxml.c", "vendor/spidermonkey/jsxml.h", "vendor/spidermonkey/lock_SunOS.s", "vendor/spidermonkey/perfect.js", "vendor/spidermonkey/plify_jsdhash.sed", "vendor/spidermonkey/prmjtime.c", "vendor/spidermonkey/prmjtime.h", "vendor/spidermonkey/resource.h", "vendor/spidermonkey/rules.mk", "vendor/spidermonkey/win32.order"]
17
17
  s.has_rdoc = true
18
18
  s.homepage = %q{http://github.com/jbarnette/johnson/wikis}
19
19
  s.rdoc_options = ["--main", "README.rdoc"]
20
20
  s.require_paths = ["lib", "ext"]
21
21
  s.rubyforge_project = %q{johnson}
22
- s.rubygems_version = %q{1.3.0}
22
+ s.rubygems_version = %q{1.3.1}
23
23
  s.summary = %q{Johnson wraps JavaScript in a loving Ruby embrace.}
24
24
  s.test_files = ["test/johnson/browser_test.rb", "test/johnson/conversions/array_test.rb", "test/johnson/conversions/boolean_test.rb", "test/johnson/conversions/callable_test.rb", "test/johnson/conversions/file_test.rb", "test/johnson/conversions/nil_test.rb", "test/johnson/conversions/number_test.rb", "test/johnson/conversions/regexp_test.rb", "test/johnson/conversions/string_test.rb", "test/johnson/conversions/struct_test.rb", "test/johnson/conversions/symbol_test.rb", "test/johnson/conversions/thread_test.rb", "test/johnson/error_test.rb", "test/johnson/extensions_test.rb", "test/johnson/nodes/array_literal_test.rb", "test/johnson/nodes/array_node_test.rb", "test/johnson/nodes/binary_node_test.rb", "test/johnson/nodes/bracket_access_test.rb", "test/johnson/nodes/delete_test.rb", "test/johnson/nodes/do_while_test.rb", "test/johnson/nodes/dot_accessor_test.rb", "test/johnson/nodes/export_test.rb", "test/johnson/nodes/for_test.rb", "test/johnson/nodes/function_test.rb", "test/johnson/nodes/if_test.rb", "test/johnson/nodes/import_test.rb", "test/johnson/nodes/label_test.rb", "test/johnson/nodes/let_test.rb", "test/johnson/nodes/object_literal_test.rb", "test/johnson/nodes/return_test.rb", "test/johnson/nodes/semi_test.rb", "test/johnson/nodes/switch_test.rb", "test/johnson/nodes/ternary_test.rb", "test/johnson/nodes/throw_test.rb", "test/johnson/nodes/try_node_test.rb", "test/johnson/nodes/typeof_test.rb", "test/johnson/nodes/unary_node_test.rb", "test/johnson/nodes/void_test.rb", "test/johnson/nodes/while_test.rb", "test/johnson/nodes/with_test.rb", "test/johnson/prelude_test.rb", "test/johnson/runtime_test.rb", "test/johnson/spidermonkey/context_test.rb", "test/johnson/spidermonkey/immutable_node_test.rb", "test/johnson/spidermonkey/js_land_proxy_test.rb", "test/johnson/spidermonkey/ruby_land_proxy_test.rb", "test/johnson/spidermonkey/runtime_test.rb", "test/johnson/version_test.rb", "test/johnson/visitors/dot_visitor_test.rb", "test/johnson/visitors/enumerating_visitor_test.rb", "test/johnson_test.rb", "test/parser_test.rb"]
25
25
 
@@ -26,7 +26,7 @@ module Johnson
26
26
  end
27
27
 
28
28
  def load(*files)
29
- files.each { |f| delegate.evaluate(IO.read(f), f, 1) }
29
+ files.each { |f| delegate.evaluate(File.read(f).gsub(/\A#!.*$/, ''), f, 1) }
30
30
  end
31
31
 
32
32
  ###
@@ -1,120 +1,14 @@
1
1
  module Johnson
2
2
  module Visitors
3
- class EnumeratingVisitor
3
+ class EnumeratingVisitor < Visitor
4
4
  attr_accessor :block
5
5
  def initialize(block)
6
6
  @block = block
7
7
  end
8
8
 
9
- def visit_SourceElements(o)
10
- block.call(o)
11
- o.value.each { |x| x.accept(self) }
12
- self
13
- end
14
-
15
- def visit_LexicalScope(o)
16
- block.call(o)
17
- o.right.accept(self)
18
- self
19
- end
20
-
21
- %w{
22
- ArrayLiteral Comma Export FunctionCall Import New ObjectLiteral
23
- VarStatement LetStatement
24
- }.each do |type|
25
- define_method(:"visit_#{type}") do |o|
26
- block.call(o)
27
- o.value.each { |x| x.accept(self) }
28
- self
29
- end
30
- end
31
-
32
- %w{ Name Number Regexp String }.each do |type|
33
- define_method(:"visit_#{type}") do |o|
34
- block.call(o)
35
- self
36
- end
37
- end
38
-
39
- %w{ Break Continue False Null This True }.each do |type|
40
- define_method(:"visit_#{type}") do |o|
41
- block.call(o)
42
- self
43
- end
44
- end
45
-
46
- def visit_For(o)
47
- block.call(o)
48
- o.init && o.init.accept(self)
49
- o.cond && o.cond.accept(self)
50
- o.update && o.update.accept(self)
51
- o.body.accept(self)
52
- self
53
- end
54
-
55
- def visit_ForIn(o)
56
- block.call(o)
57
- o.in_cond.accept(self)
58
- o.body.accept(self)
59
- self
60
- end
61
-
62
- def visit_Try(o)
63
- block.call(o)
64
- o.cond.accept(self)
65
- o.b_then && o.b_then.map { |x| x.accept(self) }
66
- o.b_else && o.b_else.accept(self)
67
- self
68
- end
69
-
70
- %w{ Ternary If Catch }.each do |node|
71
- define_method(:"visit_#{node}") do |o|
72
- block.call(o)
73
- o.cond.accept(self)
74
- o.b_then && o.b_then.accept(self)
75
- o.b_else && o.b_else.accept(self)
76
- self
77
- end
78
- end
79
- ### UNARY NODES ###
80
- %w{ BitwiseNot Delete Not Parenthesis PostfixDecrement PostfixIncrement
81
- PrefixDecrement PrefixIncrement Return Throw Typeof UnaryNegative
82
- UnaryPositive Void
83
- }.each do |node|
84
- define_method(:"visit_#{node}") do |o|
85
- block.call(o)
86
- o.value && o.value.accept(self)
87
- self
88
- end
89
- end
90
-
91
- ### FUNCTION NODES ###
92
- def visit_Function(o)
93
- block.call(o)
94
- o.body.accept(self)
95
- self
96
- end
97
-
98
- ### BINARY NODES ###
99
- %w{ And AssignExpr BracketAccess Case Default DoWhile DotAccessor Equal
100
- GetterProperty GreaterThan GreaterThanOrEqual In InstanceOf Label
101
- LessThan LessThanOrEqual NotEqual OpAdd OpAddEqual OpBitAnd
102
- OpBitAndEqual OpBitOr OpBitOrEqual OpBitXor OpBitXorEqual OpDivide
103
- OpDivideEqual OpEqual OpLShift OpLShiftEqual OpMod OpModEqual
104
- OpMultiply OpMultiplyEqual OpRShift OpRShiftEqual OpSubtract
105
- OpSubtractEqual OpURShift OpURShiftEqual Or Property SetterProperty
106
- StrictEqual StrictNotEqual Switch While With
107
- }.each do |node|
108
- define_method(:"visit_#{node}") do |o|
109
- block.call(o)
110
- o.left && o.left.accept(self)
111
- o.right && o.right.accept(self)
112
- self
113
- end
114
- end
115
-
116
- def accept(target)
117
- target.accept(self)
9
+ superclass.instance_methods.each do |method|
10
+ next unless method.to_s =~ /^visit_/
11
+ eval("def #{method}(o); block.call(o); super; end")
118
12
  end
119
13
  end
120
14
  end
@@ -0,0 +1,91 @@
1
+ module Johnson
2
+ module Visitors
3
+ class Visitor
4
+ def visit_SourceElements(o)
5
+ o.value.each { |x| x.accept(self) }
6
+ end
7
+
8
+ def visit_LexicalScope(o)
9
+ o.right.accept(self)
10
+ end
11
+
12
+ %w{
13
+ ArrayLiteral Comma Export FunctionCall Import New ObjectLiteral
14
+ VarStatement LetStatement
15
+ }.each do |type|
16
+ define_method(:"visit_#{type}") do |o|
17
+ o.value.each { |x| x.accept(self) }
18
+ end
19
+ end
20
+
21
+ %w{
22
+ Name Number Regexp String
23
+ Break Continue False Null This True
24
+ }.each do |type|
25
+ define_method(:"visit_#{type}") do |o|
26
+ end
27
+ end
28
+
29
+ def visit_For(o)
30
+ o.init && o.init.accept(self)
31
+ o.cond && o.cond.accept(self)
32
+ o.update && o.update.accept(self)
33
+ o.body.accept(self)
34
+ end
35
+
36
+ def visit_ForIn(o)
37
+ o.in_cond.accept(self)
38
+ o.body.accept(self)
39
+ end
40
+
41
+ def visit_Try(o)
42
+ o.cond.accept(self)
43
+ o.b_then && o.b_then.map { |x| x.accept(self) }
44
+ o.b_else && o.b_else.accept(self)
45
+ end
46
+
47
+ %w{ Ternary If Catch }.each do |node|
48
+ define_method(:"visit_#{node}") do |o|
49
+ o.cond.accept(self)
50
+ o.b_then && o.b_then.accept(self)
51
+ o.b_else && o.b_else.accept(self)
52
+ end
53
+ end
54
+
55
+ ### UNARY NODES ###
56
+ %w{ BitwiseNot Delete Not Parenthesis PostfixDecrement PostfixIncrement
57
+ PrefixDecrement PrefixIncrement Return Throw Typeof UnaryNegative
58
+ UnaryPositive Void
59
+ }.each do |node|
60
+ define_method(:"visit_#{node}") do |o|
61
+ o.value && o.value.accept(self)
62
+ end
63
+ end
64
+
65
+ ### FUNCTION NODES ###
66
+ def visit_Function(o)
67
+ o.body.accept(self)
68
+ end
69
+
70
+ ### BINARY NODES ###
71
+ %w{ And AssignExpr BracketAccess Case Default DoWhile DotAccessor Equal
72
+ GetterProperty GreaterThan GreaterThanOrEqual In InstanceOf Label
73
+ LessThan LessThanOrEqual NotEqual OpAdd OpAddEqual OpBitAnd
74
+ OpBitAndEqual OpBitOr OpBitOrEqual OpBitXor OpBitXorEqual OpDivide
75
+ OpDivideEqual OpEqual OpLShift OpLShiftEqual OpMod OpModEqual
76
+ OpMultiply OpMultiplyEqual OpRShift OpRShiftEqual OpSubtract
77
+ OpSubtractEqual OpURShift OpURShiftEqual Or Property SetterProperty
78
+ StrictEqual StrictNotEqual Switch While With
79
+ }.each do |node|
80
+ define_method(:"visit_#{node}") do |o|
81
+ o.left && o.left.accept(self)
82
+ o.right && o.right.accept(self)
83
+ end
84
+ end
85
+
86
+ def accept(target)
87
+ target.accept(self)
88
+ end
89
+ end
90
+ end
91
+ end
@@ -1,3 +1,4 @@
1
+ require 'johnson/visitors/visitor'
1
2
  require 'johnson/visitors/sexp_visitor'
2
3
  require 'johnson/visitors/ecma_visitor'
3
4
  require 'johnson/visitors/dot_visitor'
@@ -1,4 +1,5 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__), "/../helper"))
2
+ require 'tempfile'
2
3
 
3
4
  module Johnson
4
5
  class RuntimeTest < Johnson::TestCase
@@ -14,6 +15,12 @@ module Johnson
14
15
  assert_equal(1, @runtime.evaluate('eval("1");'))
15
16
  end
16
17
 
18
+ def test_shebang_removal
19
+ t = Tempfile.new("johnson_shebang")
20
+ t.open { |tf| tf.write "#!/usr/bin/johnson\ntrue;" }
21
+ assert Johnson.load(t.path)
22
+ end
23
+
17
24
  def test_js_throws_compile_errors
18
25
  assert_raises(Johnson::Error) {
19
26
  @runtime.evaluate("var js_lambda = function(x) { return x ** 2; }")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jbarnette-johnson
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.20081126120511
4
+ version: 1.0.0.20090127202936
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Barnette
@@ -12,7 +12,7 @@ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
14
 
15
- date: 2008-11-26 00:00:00 -08:00
15
+ date: 2009-01-27 00:00:00 -08:00
16
16
  default_executable: johnson
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
@@ -106,6 +106,7 @@ files:
106
106
  - lib/johnson/visitors/ecma_visitor.rb
107
107
  - lib/johnson/visitors/enumerating_visitor.rb
108
108
  - lib/johnson/visitors/sexp_visitor.rb
109
+ - lib/johnson/visitors/visitor.rb
109
110
  - lib/rails/init.rb
110
111
  - srcs/xmlparser-0.6.8.tar
111
112
  - test/assets/index.html