Rkelly 1.0.0 Released


#1

YES. You read the subject line correctly. RKelly is released.

rkelly version 1.0.0 has been released!

The RKelly library will parse JavaScript and return a parse tree.

Changes:

RKelly CHANGELOG

0.0.1

  • Added dynamic method assignment
  • Birthday!

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