Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #17923
| From | JJ <jaejunks@nah.meh> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Source code "objectifying" technique? |
| Date | 2013-01-03 20:33 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <XnsA13E24E26DB86jj@0.0.0.55> (permalink) |
| References | <XnsA13DB38A51C6jj@0.0.0.55> <efe2e252-786f-4956-8d17-237cdeb6681e@f8g2000yqa.googlegroups.com> |
Scott Sauyet <scott.sauyet@gmail.com> wrote: > My first question would be how you would distinguish between the > global variables that you do want to convert and those (possibly) > accidental ones like `a` in `ghi()` and `jkl()` above. The "a" is a function parameter. It's practically a local object of that function rather than a global object. The code are merely examples that some functions depends on their own library's variable. > But if you want to pursue this, I would suggest you look at Javascript > parsers. There are a number of them written in Javascript, including > Uglify, Narcissus, Esprima, and Acorn. I'm sure you can find them all > quickly with a web search. Once you have the abstract syntax tree > representation of this code, especially if they tie all statements to > lines/columns in the code, perhaps you would be able to use this to > create a new representation that simply inserted "theLib." in all the > correct spots. Isn't Uglify a code compressor? I do have an "uglify.js", but it's based on simple regex search+replace. It's not aware of code syntax nor context. The other three are new to me. I'll check them out. Thanks.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Source code "objectifying" technique? JJ <jaejunks@nah.meh> - 2013-01-03 10:34 +0000
Re: Source code "objectifying" technique? Stefan Weiss <krewecherl@gmail.com> - 2013-01-03 19:32 +0100
Re: Source code "objectifying" technique? JJ <jaejunks@nah.meh> - 2013-01-03 20:13 +0000
Re: Source code "objectifying" technique? Stefan Weiss <krewecherl@gmail.com> - 2013-01-03 23:57 +0100
Re: Source code "objectifying" technique? Stefan Weiss <krewecherl@gmail.com> - 2013-01-04 00:44 +0100
Re: Source code "objectifying" technique? JJ <jaejunks@nah.meh> - 2013-01-04 02:00 +0000
Re: Source code "objectifying" technique? Scott Sauyet <scott.sauyet@gmail.com> - 2013-01-03 10:37 -0800
Re: Source code "objectifying" technique? Scott Sauyet <scott.sauyet@gmail.com> - 2013-01-03 10:43 -0800
Re: Source code "objectifying" technique? JJ <jaejunks@nah.meh> - 2013-01-03 20:33 +0000
Re: Source code "objectifying" technique? Scott Sauyet <scott.sauyet@gmail.com> - 2013-01-03 13:09 -0800
Re: Source code "objectifying" technique? JJ <jaejunks@nah.meh> - 2013-01-04 02:33 +0000
csiph-web