javascript parser in lua

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

javascript parser in lua

Gary Madarm
I've been using lua-gumbo to parse html, but now need to parse javascript embedded in the HTML as well. Short of using regex's what can I use to parse a document containing several javascript window.open() functions in lua to access the URI?

thanks,

- G
Reply | Threaded
Open this post in threaded view
|

Re: javascript parser in lua

Coda Highland
On Wed, Nov 12, 2014 at 1:22 PM, Gordon Madarm <[hidden email]> wrote:
> I've been using lua-gumbo to parse html, but now need to parse javascript
> embedded in the HTML as well. Short of using regex's what can I use to parse
> a document containing several javascript window.open() functions in lua to
> access the URI?
>
> thanks,
>
> - G

It'd be seriously overkill to drag in a complete JS parser just for
that. Use string functions to search the JS code for window.open and
then grab the URL from there.

/s/ Adam

Reply | Threaded
Open this post in threaded view
|

Re: javascript parser in lua

Daurnimator
In reply to this post by Gary Madarm
On 12 November 2014 16:22, Gordon Madarm <[hidden email]> wrote:
I've been using lua-gumbo to parse html, but now need to parse javascript embedded in the HTML as well. Short of using regex's what can I use to parse a document containing several javascript window.open() functions in lua to access the URI?

You could look into using CASTL to compile esprima to lua.