Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #17923
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | JJ <jaejunks@nah.meh> |
| Newsgroups | comp.lang.javascript |
| Subject | Re: Source code "objectifying" technique? |
| Date | Thu, 3 Jan 2013 20:33:08 +0000 (UTC) |
| Organization | A noiseless patient Spider |
| Lines | 21 |
| Message-ID | <XnsA13E24E26DB86jj@0.0.0.55> (permalink) |
| References | <XnsA13DB38A51C6jj@0.0.0.55> <efe2e252-786f-4956-8d17-237cdeb6681e@f8g2000yqa.googlegroups.com> |
| Injection-Date | Thu, 3 Jan 2013 20:33:08 +0000 (UTC) |
| Injection-Info | mx04.eternal-september.org; posting-host="f8ea35d8958493b8650c0b3ef1b6a34b"; logging-data="15812"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19h+X/ctIVUyV5n0vft7EL2RLxgmGYlMak=" |
| User-Agent | Xnews/5.04.25 |
| X-Face | \*\`0(1j~VfYC>ebz[&O.]=,Nm\oRM{of,liRO#7Eqi4|!]!(Gs=Akgh{J)605>C9Air?pad{sSZ09u+A7f<^paR"/NH_#<mE1S"hde\c6PZLUB[t/s5-+Iu5DSc?P0+4%,Hl |
| Cancel-Lock | sha1:gQcEL0KpKkyb+6NtQrAOzGzvoq4= |
| Xref | csiph.com comp.lang.javascript:17923 |
Show key headers only | View raw
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