Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8351357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:36:24+00:00 2026-06-09T08:36:24+00:00

I want to parse through a javascript and find all the variable declarations, attributions,

  • 0

I want to parse through a javascript and find all the variable declarations, attributions, and calls to functions from a specific library.

What would be the best approach:regular expressions, lexer, use something already done that does that (does it exist?)….?

What I want in fact is to be assured that an object namespace and methods are not modified, and this through a static analysis.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T08:36:25+00:00Added an answer on June 9, 2026 at 8:36 am

    You can not do it with regexes and probably you also do not want to write you own implementation of ecma-standard 262 (It is a total overkill).
    As for me I dig google’s V8 javascript engine, more precisely PyV8. I suggest you can use it.

    If you had problems there is the code I used to install (pip installation had an error for my x64 system, so I used sources):

    apt-get install subversion scons libboost-python-dev
    svn checkout http://v8.googlecode.com/svn/trunk/ v8
    svn checkout http://pyv8.googlecode.com/svn/trunk/ pyv8
    cd v8
    export PyV8=`pwd`
    cd ../pyv8
    sudo python setup.py build
    sudo python setup.py install
    

    As I remember these commands did not make errors for me. (I copypasted it but it worked)

    Answer to the question itself:
    More complex hello wolrd example, list some varibales of the global object:

    import PyV8
    
    class Global(PyV8.JSClass):      # define a compatible javascript class
        def hello(self):               # define a method
            print "Hello World"
    
        def alert(self, message): # my own alert function
            print type(message), '  ', message
    
        @property
        def GObject(self): return self
    
        def __setattr__(self, key, value):
            super(Global, self).__setattr__(key, value)
            print key, '=', value
    
    G = Global()
    ctxt = PyV8.JSContext(G)
    ctxt.enter()
    ctxt.eval("var a=hello; GObject.b=1.0; a();")
    list_all_cmd = '''for (myKey in GObject){
    alert(GObject[myKey]);
    }'''
    ctxt.eval(list_all_cmd)
    ctxt.leave()
    

    (In browsers you should call you global object – Window)
    This code will output:

    b = 1
    Hello World
    <class '__main__.Global'>    <__main__.Global object at 0x7f202c9159d0>
    <class '_PyV8.JSFunction'>    function () { [native code] }
    <type 'int'>    1
    <class '_PyV8.JSFunction'>    function () { [native code] }
    <class '_PyV8.JSFunction'>    function () { [native code] }
    <class '_PyV8.JSFunction'>    function () { [native code] }
    <class '_PyV8.JSFunction'>    function () { [native code] }
    <class '_PyV8.JSFunction'>    function () { [native code] }
    <class '_PyV8.JSFunction'>    function () { [native code] }
    <class '_PyV8.JSFunction'>    function () { [native code] }
    <class '_PyV8.JSFunction'>    function () { [native code] }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a scenario where I want to parse through all the values displayed
I want to parse an XML file through JavaScript. I wrote the following code,
I would like to parse through jquery. When I want to parse, there is
I'd like to find (using javascript) all of the references to image links on
I am trying to parse through a typical form using jquery. I want to
I want to have a Javascript function load information for an image from an
Background I want to be able to parse Javascript source in a Delphi Application.
I want to build a chatbot which can parse through given knowledge to add
I want to create a batch file which will parse through a given directory
I am building a TSQL query to parse through a FTP log from FileZilla.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.