Trying to get a list of available JavaScript functions/methods

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • thegman

    Trying to get a list of available JavaScript functions/methods

    Hi all,
    I'm trying to get list of JavaScript methods/functions in a script
    file in much the same a good text editor will, the difference being
    that I need to output it to a file or stdout, or some other way of
    "getting at it" automatically. I'm not fussy about what language I
    use, be it JavaScript or something else. Anyone got any ideas? I've
    tried Exuberant Ctags, but that does not seem to work on very advanced
    scripts like Ext.

    I'm guessing the best way would be to have some kind of interrogation
    of a HTMLScriptEleme nt or something, but I can't see how to get a
    simple list of functions/methods from that.

    Alternatively, any C library for parsing JS might be a good idea, even
    Python, Perl, PHP, whatever really, anyone got any recommendations ?

    Cheers

    Garry
  • Thomas 'PointedEars' Lahn

    #2
    Re: Trying to get a list of available JavaScript functions/methods

    thegman wrote:
    I'm trying to get list of JavaScript methods/functions in a script
    file in much the same a good text editor will, the difference being
    that I need to output it to a file or stdout, or some other way of
    "getting at it" automatically.
    You are about the 1337th person to ask that question here. Care to do
    a *little* research before you bother other people with your problems?




    PointedEars
    --
    Anyone who slaps a 'this page is best viewed with Browser X' label on
    a Web page appears to be yearning for the bad old days, before the Web,
    when you had very little chance of reading a document written on another
    computer, another word processor, or another network. -- Tim Berners-Lee

    Comment

    • thegman

      #3
      Re: Trying to get a list of available JavaScript functions/methods

      On May 10, 3:30 pm, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
      wrote:
      thegman wrote:
      I'm trying to get list of JavaScript methods/functions in a script
      file in much the same a good text editor will, the difference being
      that I need to output it to a file or stdout, or some other way of
      "getting at it" automatically.
      >
      You are about the 1337th person to ask that question here.  Care to do
      a *little* research before you bother other people with your problems?
      >

      >
      PointedEars
      --
      Anyone who slaps a 'this page is best viewed with Browser X' label on
      a Web page appears to be yearning for the bad old days, before the Web,
      when you had very little chance of reading a document written on another
      computer, another word processor, or another network. -- Tim Berners-Lee

      I've looked around quite a lot, maybe I'm the worst Googler in the
      world or something, but I can't find what I'm looking for, if
      someone's got some links, I'd appreciate it.

      Thanks

      Garry

      Comment

      • Thomas 'PointedEars' Lahn

        #4
        Re: Trying to get a list of available JavaScript functions/methods

        thegman wrote:
        [...] Thomas 'PointedEars' Lahn [...] wrote:
        >thegman wrote:
        >>I'm trying to get list of JavaScript methods/functions in a script
        >>file in much the same a good text editor will, the difference being
        >>that I need to output it to a file or stdout, or some other way of
        >>"getting at it" automatically.
        >You are about the 1337th person to ask that question here. Care to do
        >a *little* research before you bother other people with your problems?
        >>
        >http://jibbering.com/faq/
        >[...]
        Please trim your quotes as also recommended by the FAQ Notes.
        I've looked around quite a lot, maybe I'm the worst Googler in the
        world or something, but I can't find what I'm looking for, if
        someone's got some links, I'd appreciate it.



        PointedEars
        --
        Prototype.js was written by people who don't know javascript for people
        who don't know javascript. People who don't know javascript are not
        the best source of advice on designing systems that use javascript.
        -- Richard Cornford, cljs, <f806at$ail$1$8 300dec7@news.de mon.co.uk>

        Comment

        • VK

          #5
          Re: Trying to get a list of available JavaScript functions/methods

          On May 10, 6:14 pm, thegman <taylor.ga...@g mail.comwrote:
          I'm trying to get list of JavaScript methods/functions in a script
          1) Top level functions only or all functions together, including
          anonymous and nested ones? The latter one is pretty much impossible w/
          o operating on a lower level via XPCOM/C (Gecko) or C++ (IE) - just to
          let you know in advance.

          2) Custom functions only or everything? Say setTimeout should be in
          your list or now?

          3) For the running script or for the script source treated as plain
          text?

          With these questions answered the rest should be rather easy.

          Comment

          • thegman

            #6
            Re: Trying to get a list of available JavaScript functions/methods

            On May 10, 9:25 pm, VK <schools_r...@y ahoo.comwrote:
            On May 10, 6:14 pm, thegman <taylor.ga...@g mail.comwrote:
            >
            I'm trying to get list of JavaScript methods/functions in a script
            >
            1) Top level functions only or all functions together, including
            anonymous and nested ones? The latter one is pretty much impossible w/
            o operating on a lower level via XPCOM/C (Gecko) or C++ (IE) - just to
            let you know in advance.
            All functions, but particularly functions/methods defined in third-
            party scripts such as Ext.
            >
            2) Custom functions only or everything? Say setTimeout should be in
            your list or now?
            Would be good to have setTimeout and other builtins, but not
            essential.
            >
            3) For the running script or for the script source treated as plain
            text?
            Not fussy, I don't mind doing this with JavaScript, or pretty much any
            other language.
            >
            With these questions answered the rest should be rather easy.
            Thanks for the reply, I've been looking at this most of the day, and
            not come up with any bulletproof solutions yet.

            Cheers!

            Garry

            Comment

            • VK

              #7
              Re: Trying to get a list of available JavaScript functions/methods

              I'm trying to get list of JavaScript methods/functions in a script
              >
              1) Top level functions only or all functions together, including
              anonymous and nested ones? The latter one is pretty much
              impossible w/o operating on a lower level via XPCOM/C (Gecko) or
              C++ (IE) - just to let you know in advance.
              >
              All functions, but particularly functions/methods defined in third-
              party scripts such as Ext.
              What is your level of programming experience? In the particular how
              would you define "all anonymous functions"? All named references to a
              function or the initial reference only? If you don't understand the
              question I can try to rephrase it with a sample.
              2) Custom functions only or everything? Say setTimeout should be
              in your list or not?
              >
              Would be good to have setTimeout and other builtins, but not
              essential.
              'k

              3) For the running script or for the script source treated
              as plain text?
              Not fussy, I don't mind doing this with JavaScript,
              or pretty much any other language.
              You didn't understand me. My question was: do you want to study a
              running code for method references - or you want to parse some text
              say library.js to find all occurrences of "function" string in it and
              regexp with it?

              Comment

              • Dr J R Stockton

                #8
                Re: Trying to get a list of available JavaScript functions/methods

                In comp.lang.javas cript message <4825B173.60205 08@PointedEars. de>, Sat,
                10 May 2008 16:30:11, Thomas 'PointedEars' Lahn <PointedEars@we b.de>
                posted:
                >thegman wrote:
                >I'm trying to get list of JavaScript methods/functions in a script
                >file in much the same a good text editor will, the difference being
                >that I need to output it to a file or stdout, or some other way of
                >"getting at it" automatically.
                >
                >You are about the 1337th person to ask that question here. Care to do
                >a *little* research before you bother other people with your problems?
                >
                >http://jibbering.com/faq/
                If you had intended to be helpful, you would have given the number of
                the relevant section. There is no section which, to the intended
                audience, will appear helpful. The OP will realise that, whatever your
                intent, your main effect when replying to newcomers is to demonstrate
                how obnoxious you are.

                --
                (c) John Stockton, nr London UK. ???@merlyn.demo n.co.uk Turnpike v6.05 MIME.
                Web <URL:http://www.merlyn.demo n.co.uk/- FAQish topics, acronyms, & links.
                Check boilerplate spelling -- error is a public sign of incompetence.
                Never fully trust an article from a poster who gives no full real name.

                Comment

                • thegman

                  #9
                  Re: Trying to get a list of available JavaScript functions/methods

                  On May 10, 10:52 pm, VK <schools_r...@y ahoo.comwrote:
                  I'm trying to get list of JavaScript methods/functions in a script
                  >
                  1) Top level functions only or all functions together, including
                  anonymous and nested ones? The latter one is pretty much
                  impossible w/o operating on a lower level via XPCOM/C (Gecko) or
                  C++ (IE) - just to let you know in advance.
                  >
                  All functions, but particularly functions/methods defined in third-
                  party scripts such as Ext.
                  >
                  What is your level of programming experience? In the particular how
                  would you define "all anonymous functions"? All named references to a
                  function or the initial reference only? If you don't understand the
                  question I can try to rephrase it with a sample.
                  My programming experience is longer than I care to remember, but not
                  JS, not even slightly, which is probably not helping my cause much. I
                  guess any function/method which is usable, I'd like to list that.

                  >
                  You didn't understand me. My question was: do you want to study a
                  running code for method references - or you want to parse some text
                  say library.js to find all occurrences of "function" string in it and
                  regexp with it?
                  I understand your question, it's just that I'm not bothered which way
                  I end up doing this, I can use JavaScript in a running browser, and
                  capture the output, or indeed run some kind of regex thing and get the
                  results that way, I'm relatively indifferent about how I get this
                  done, just so long as it works. My first thought was to use something
                  like ctags, or maybe a Python parser, but I could not find anything
                  which was much good. My thoughts then turned to using the DOM tree or
                  something like that, which I'd expect to be a bit more robust, after
                  all, what understand JS better than a browser?

                  Thanks

                  Garry

                  Comment

                  • Thomas 'PointedEars' Lahn

                    #10
                    Re: Trying to get a list of available JavaScript functions/methods

                    [snipped attribution novel]

                    Dr J R Stockton wrote:
                    Thomas 'PointedEars' Lahn posted:
                    >thegman wrote:
                    >>I'm trying to get list of JavaScript methods/functions in a script
                    >>file in much the same a good text editor will, the difference being
                    >>that I need to output it to a file or stdout, or some other way of
                    >>"getting at it" automatically.
                    >You are about the 1337th person to ask that question here. Care to do
                    >a *little* research before you bother other people with your problems?
                    >>
                    >http://jibbering.com/faq/
                    >
                    If you had intended to be helpful, you would have given the number of
                    the relevant section. There is no section which, to the intended
                    audience, will appear helpful. [snipped flame]
                    The relevant section is the one describing where the newsgroup's archives are.


                    PointedEars
                    --
                    Anyone who slaps a 'this page is best viewed with Browser X' label on
                    a Web page appears to be yearning for the bad old days, before the Web,
                    when you had very little chance of reading a document written on another
                    computer, another word processor, or another network. -- Tim Berners-Lee

                    Comment

                    • RobG

                      #11
                      Re: Trying to get a list of available JavaScript functions/methods

                      On May 11, 12:14 am, thegman <taylor.ga...@g mail.comwrote:
                      Hi all,
                      I'm trying to get list of JavaScript methods/functions in a script
                      file in much the same a good text editor will, the difference being
                      that I need to output it to a file or stdout, or some other way of
                      "getting at it" automatically. I'm not fussy about what language I
                      use, be it JavaScript or something else. Anyone got any ideas? I've
                      tried Exuberant Ctags, but that does not seem to work on very advanced
                      scripts like Ext.
                      >
                      I'm guessing the best way would be to have some kind of interrogation
                      of a HTMLScriptEleme nt or something, but I can't see how to get a
                      simple list of functions/methods from that.
                      >
                      Alternatively, any C library for parsing JS might be a good idea, even
                      Python, Perl, PHP, whatever really, anyone got any recommendations ?
                      This thread may help:

                      <URL:
                      http://groups.google.com.au/group/co...81a59080b87b5b
                      >

                      --
                      Rob

                      Comment

                      • Dr J R Stockton

                        #12
                        Re: Trying to get a list of available JavaScript functions/methods

                        In comp.lang.javas cript message <4826B8C5.10500 00@PointedEars. de>, Sun,
                        11 May 2008 11:13:41, Thomas 'PointedEars' Lahn <PointedEars@we b.de>
                        posted:
                        >[snipped attribution novel]
                        >
                        >Dr J R Stockton wrote:
                        >Thomas 'PointedEars' Lahn posted:
                        >>thegman wrote:
                        >>>I'm trying to get list of JavaScript methods/functions in a script
                        >>>file in much the same a good text editor will, the difference being
                        >>>that I need to output it to a file or stdout, or some other way of
                        >>>"getting at it" automatically.
                        >>You are about the 1337th person to ask that question here. Care to do
                        >>a *little* research before you bother other people with your problems?
                        >>>
                        >>http://jibbering.com/faq/
                        >>
                        >If you had intended to be helpful, you would have given the number of
                        >the relevant section. There is no section which, to the intended
                        >audience, will appear helpful. [snipped flame]
                        I did not write all of that. Don't quote misleadingly. Still, it's
                        nice to know that you do see that you are considered to be like. Once
                        you start to believe that (you are a slow learner), progress might be
                        made.
                        >The relevant section is the one describing where the newsgroup's archives are.
                        OP (thegman) : did you realise that? Do you consider it helpful?

                        --
                        (c) John Stockton, nr London UK. ?@merlyn.demon. co.uk BP7, Delphi 3 & 2006.
                        <URL:http://www.merlyn.demo n.co.uk/TP/BP/Delphi/&c., FAQqy topics & links;
                        <URL:http://www.bancoems.co m/CompLangPascalD elphiMisc-MiniFAQ.htmclpd mFAQ;
                        <URL:http://www.borland.com/newsgroups/guide.htmlnews: borland.* Guidelines

                        Comment

                        • Max Cornbread

                          #13
                          Re: Trying to get a list of available JavaScript functions/methods

                          PointedEars, you are so unhelpful in all your "wisdom." I made an
                          account just to tell you how useless your comments are even though you
                          appear to know something.


                          *** Sent via Developersdex http://www.developersdex.com ***

                          Comment

                          Working...