Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include rkelly library with JSDetox and apply bugfixes. Fixes #7
- Loading branch information
Showing
70 changed files
with
7,295 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
= RKelly CHANGELOG | ||
|
||
=== 1.0.3 | ||
|
||
* Bugfixes | ||
|
||
* Fixed a typo in visitor.rb | ||
* Fixed syntax error class | ||
* Regex tonenization (thanks Josh Dzielak) | ||
|
||
=== 1.0.1 | ||
|
||
* Bugfixes | ||
|
||
* Fixed nondeterministic file order loading issue. | ||
|
||
=== 0.0.1 | ||
|
||
* Added dynamic method assignment | ||
* Birthday! | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,199 @@ | ||
CHANGELOG.rdoc | ||
Manifest.txt | ||
README.rdoc | ||
Rakefile | ||
lib/parser.y | ||
lib/rkelly.rb | ||
lib/rkelly/constants.rb | ||
lib/rkelly/generated_parser.rb | ||
lib/rkelly/js.rb | ||
lib/rkelly/js/array.rb | ||
lib/rkelly/js/base.rb | ||
lib/rkelly/js/boolean.rb | ||
lib/rkelly/js/function.rb | ||
lib/rkelly/js/function_prototype.rb | ||
lib/rkelly/js/global_object.rb | ||
lib/rkelly/js/math.rb | ||
lib/rkelly/js/nan.rb | ||
lib/rkelly/js/number.rb | ||
lib/rkelly/js/object.rb | ||
lib/rkelly/js/object_prototype.rb | ||
lib/rkelly/js/property.rb | ||
lib/rkelly/js/scope.rb | ||
lib/rkelly/js/string.rb | ||
lib/rkelly/lexeme.rb | ||
lib/rkelly/nodes.rb | ||
lib/rkelly/nodes/binary_node.rb | ||
lib/rkelly/nodes/bracket_accessor_node.rb | ||
lib/rkelly/nodes/case_clause_node.rb | ||
lib/rkelly/nodes/comma_node.rb | ||
lib/rkelly/nodes/conditional_node.rb | ||
lib/rkelly/nodes/dot_accessor_node.rb | ||
lib/rkelly/nodes/for_in_node.rb | ||
lib/rkelly/nodes/for_node.rb | ||
lib/rkelly/nodes/function_call_node.rb | ||
lib/rkelly/nodes/function_decl_node.rb | ||
lib/rkelly/nodes/function_expr_node.rb | ||
lib/rkelly/nodes/if_node.rb | ||
lib/rkelly/nodes/label_node.rb | ||
lib/rkelly/nodes/new_expr_node.rb | ||
lib/rkelly/nodes/node.rb | ||
lib/rkelly/nodes/not_strict_equal_node.rb | ||
lib/rkelly/nodes/op_equal_node.rb | ||
lib/rkelly/nodes/postfix_node.rb | ||
lib/rkelly/nodes/prefix_node.rb | ||
lib/rkelly/nodes/property_node.rb | ||
lib/rkelly/nodes/resolve_node.rb | ||
lib/rkelly/nodes/strict_equal_node.rb | ||
lib/rkelly/nodes/try_node.rb | ||
lib/rkelly/nodes/var_decl_node.rb | ||
lib/rkelly/parser.rb | ||
lib/rkelly/runtime.rb | ||
lib/rkelly/runtime/ruby_function.rb | ||
lib/rkelly/runtime/scope_chain.rb | ||
lib/rkelly/syntax_error.rb | ||
lib/rkelly/token.rb | ||
lib/rkelly/tokenizer.rb | ||
lib/rkelly/visitable.rb | ||
lib/rkelly/visitors.rb | ||
lib/rkelly/visitors/dot_visitor.rb | ||
lib/rkelly/visitors/ecma_visitor.rb | ||
lib/rkelly/visitors/enumerable_visitor.rb | ||
lib/rkelly/visitors/evaluation_visitor.rb | ||
lib/rkelly/visitors/function_visitor.rb | ||
lib/rkelly/visitors/pointcut_visitor.rb | ||
lib/rkelly/visitors/real_sexp_visitor.rb | ||
lib/rkelly/visitors/sexp_visitor.rb | ||
lib/rkelly/visitors/visitor.rb | ||
test/ecma_script_test_case.rb | ||
test/execute_test_case.rb | ||
test/execution_contexts/test_10_1_3-1.rb | ||
test/expressions/test_11_3_1.rb | ||
test/expressions/test_11_3_2.rb | ||
test/expressions/test_11_4_2.rb | ||
test/expressions/test_11_4_3.rb | ||
test/expressions/test_11_4_4.rb | ||
test/expressions/test_11_4_5.rb | ||
test/expressions/test_11_4_6.rb | ||
test/expressions/test_11_4_8.rb | ||
test/expressions/test_11_4_9.rb | ||
test/expressions/test_11_5_1.rb | ||
test/expressions/test_11_5_2.rb | ||
test/expressions/test_11_5_3.rb | ||
test/expressions/test_11_6_1-1.rb | ||
test/expressions/test_11_9_1.rb | ||
test/function/test_15_3_1_1-1.rb | ||
test/global_object/test_15_1_1_1.rb | ||
test/global_object/test_15_1_1_2.rb | ||
test/global_object/test_15_1_1_3.rb | ||
test/helper.rb | ||
test/node_test_case.rb | ||
test/object/test_15_2_1_1.rb | ||
test/object/test_15_2_1_2.rb | ||
test/object/test_15_2_2_1.rb | ||
test/statements/test_12_5-1.rb | ||
test/test_add_node.rb | ||
test/test_arguments_node.rb | ||
test/test_array_node.rb | ||
test/test_assign_expr_node.rb | ||
test/test_automatic_semicolon_insertion.rb | ||
test/test_bit_and_node.rb | ||
test/test_bit_or_node.rb | ||
test/test_bit_x_or_node.rb | ||
test/test_bitwise_not_node.rb | ||
test/test_block_node.rb | ||
test/test_bracket_accessor_node.rb | ||
test/test_break_node.rb | ||
test/test_case_block_node.rb | ||
test/test_case_clause_node.rb | ||
test/test_comma_node.rb | ||
test/test_comments.rb | ||
test/test_conditional_node.rb | ||
test/test_const_statement_node.rb | ||
test/test_continue_node.rb | ||
test/test_delete_node.rb | ||
test/test_divide_node.rb | ||
test/test_do_while_node.rb | ||
test/test_dot_accessor_node.rb | ||
test/test_ecma_visitor.rb | ||
test/test_element_node.rb | ||
test/test_empty_statement_node.rb | ||
test/test_equal_node.rb | ||
test/test_evaluation_visitor.rb | ||
test/test_expression_statement_node.rb | ||
test/test_false_node.rb | ||
test/test_for_in_node.rb | ||
test/test_for_node.rb | ||
test/test_function_body_node.rb | ||
test/test_function_call_node.rb | ||
test/test_function_decl_node.rb | ||
test/test_function_expr_node.rb | ||
test/test_function_visitor.rb | ||
test/test_getter_property_node.rb | ||
test/test_global_object.rb | ||
test/test_greater_node.rb | ||
test/test_greater_or_equal_node.rb | ||
test/test_if_node.rb | ||
test/test_in_node.rb | ||
test/test_instance_of_node.rb | ||
test/test_label_node.rb | ||
test/test_left_shift_node.rb | ||
test/test_less_node.rb | ||
test/test_less_or_equal_node.rb | ||
test/test_line_number.rb | ||
test/test_logical_and_node.rb | ||
test/test_logical_not_node.rb | ||
test/test_logical_or_node.rb | ||
test/test_modulus_node.rb | ||
test/test_multiply_node.rb | ||
test/test_new_expr_node.rb | ||
test/test_not_equal_node.rb | ||
test/test_not_strict_equal_node.rb | ||
test/test_null_node.rb | ||
test/test_number_node.rb | ||
test/test_object_literal_node.rb | ||
test/test_op_and_equal_node.rb | ||
test/test_op_divide_equal_node.rb | ||
test/test_op_equal_node.rb | ||
test/test_op_l_shift_equal_node.rb | ||
test/test_op_minus_equal_node.rb | ||
test/test_op_mod_equal_node.rb | ||
test/test_op_multiply_equal_node.rb | ||
test/test_op_or_equal_node.rb | ||
test/test_op_plus_equal_node.rb | ||
test/test_op_r_shift_equal_node.rb | ||
test/test_op_u_r_shift_equal_node.rb | ||
test/test_op_x_or_equal_node.rb | ||
test/test_parameter_node.rb | ||
test/test_parser.rb | ||
test/test_pointcut_visitor.rb | ||
test/test_postfix_node.rb | ||
test/test_prefix_node.rb | ||
test/test_property_node.rb | ||
test/test_regexp_node.rb | ||
test/test_resolve_node.rb | ||
test/test_return_node.rb | ||
test/test_right_shift_node.rb | ||
test/test_rkelly.rb | ||
test/test_runtime.rb | ||
test/test_scope_chain.rb | ||
test/test_setter_property_node.rb | ||
test/test_source_elements.rb | ||
test/test_strict_equal_node.rb | ||
test/test_string_node.rb | ||
test/test_subtract_node.rb | ||
test/test_switch_node.rb | ||
test/test_this_node.rb | ||
test/test_throw_node.rb | ||
test/test_tokenizer.rb | ||
test/test_true_node.rb | ||
test/test_try_node.rb | ||
test/test_type_of_node.rb | ||
test/test_unary_minus_node.rb | ||
test/test_unary_plus_node.rb | ||
test/test_unsigned_right_shift_node.rb | ||
test/test_var_decl_node.rb | ||
test/test_var_statement_node.rb | ||
test/test_void_node.rb | ||
test/test_while_node.rb | ||
test/test_with_node.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
= RKelly | ||
|
||
* http://rkelly.rubyforge.org/ | ||
|
||
== DESCRIPTION | ||
|
||
The RKelly library will parse JavaScript and return a parse tree. | ||
|
||
== Example | ||
|
||
## | ||
# Iterate over and modify a JavaScript AST. Then print the modified | ||
# AST as JavaScript. | ||
require 'rkelly' | ||
|
||
parser = RKelly::Parser.new | ||
ast = parser.parse( | ||
"for(var i = 0; i < 10; i++) { var x = 5 + 5; }" | ||
) | ||
|
||
ast.each do |node| | ||
node.value = 'hello' if node.value == 'i' | ||
node.name = 'hello' if node.respond_to?(:name) && node.name == 'i' | ||
end | ||
puts ast.to_ecma # => awesome javascript | ||
|
||
== Acknowledgments | ||
|
||
The original javascript parser was was taken from rbnarcissus written by | ||
Paul Sowden. Thanks Paul! | ||
|
||
http://idontsmoke.co.uk/2005/rbnarcissus/ | ||
|
||
The current parser was ported from WebKit. Thank you WebKit team! | ||
|
||
== License | ||
|
||
The MIT License | ||
|
||
Copyright (c) 2007, 2008, 2009 Aaron Patterson, John Barnette | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
require 'rubygems' | ||
require 'hoe' | ||
|
||
Hoe.plugin :gemspec # `gem install hoe-gemspec` | ||
Hoe.plugin :git # `gem install hoe-git` | ||
|
||
GENERATED_PARSER = "lib/rkelly/generated_parser.rb" | ||
|
||
HOE = Hoe.spec('rkelly') do |p| | ||
developer('Aaron Patterson', 'aaron.patterson@gmail.com') | ||
self.readme_file = 'README.rdoc' | ||
self.history_file = 'CHANGELOG.rdoc' | ||
self.extra_rdoc_files = FileList['*.rdoc'] | ||
self.clean_globs = [GENERATED_PARSER] | ||
end | ||
|
||
file GENERATED_PARSER => "lib/parser.y" do |t| | ||
if ENV['DEBUG'] | ||
sh "racc -g -v -o #{t.name} #{t.prerequisites.first}" | ||
else | ||
sh "racc -o #{t.name} #{t.prerequisites.first}" | ||
end | ||
end | ||
|
||
task :parser => GENERATED_PARSER | ||
|
||
# make sure the parser's up-to-date when we test | ||
Rake::Task[:test].prerequisites << :parser | ||
Rake::Task[:check_manifest].prerequisites << :parser | ||
|
||
namespace :gem do | ||
task :spec do | ||
File.open("#{HOE.name}.gemspec", 'w') do |f| | ||
HOE.spec.version = "#{HOE.version}.#{Time.now.strftime("%Y%m%d%H%M%S")}" | ||
f.write(HOE.spec.to_ruby) | ||
end | ||
end | ||
end |
Oops, something went wrong.