1

Is there any library or scripts out there that i can use to extract classes and method structure of any *.js javascript file? (ideally would be nice to be able to iterate classes and methods, somewhat like .net reflection orto get a DOM of the structure like the DOM loads an xml file for example).

Is there any tool in any language to perform this?

thanks!

JayDee
  • 949
  • 1
  • 13
  • 20
  • possible duplicate http://stackoverflow.com/questions/275351/javascript-reflection – Philip May 15 '12 at 02:09
  • nope, not a duplicate, this is not runtime analysis of js code from javascript itself, its to read a .js file and extract the "DOM" for say, to translate javascript to another language for example. i already found Jint that can do this using ANTLR3. anyone else? – JayDee May 15 '12 at 02:35
  • since there are no classes in javascript , there is no such tools. there are different ways to mimic classes , but there are no classes per say , javascript is an object oriented langage without classes. and objects in javascript are some kind of pointers , so there is no methods attached to "instances" of "classes" , anything can be referenced by anything basically. – mpm May 15 '12 at 06:00
  • my bad, i meant javascript structure equivalent to clasees to translate into classes in other (most) OOP languages. – JayDee May 15 '12 at 12:51

1 Answers1

0

Ok, well i finally found a very good library called Jint (http://jint.codeplex.com/) which is a javascript interpreter for .Net. the interpreter can be used to generate an expression "DOM" for any javascript file (i tested jquery.js and three.js and they work fine), which can then be used to do what you want with it, like for example translate it to another language.

JayDee
  • 949
  • 1
  • 13
  • 20