[antlr-interest] Detecting javascript code

Peter Crowther peter.crowther at melandra.com
Mon Feb 28 07:21:56 PST 2011


On 28 February 2011 14:58, zbordie <bruno.costa at auditmark.com> wrote:

> I'm trying to build a tool that detects/recognizes javascript code embedded
> in any
> kind of language or file format, for example PHP, ASP.NET, etc. . Not
> just HTML.
>
> What's your use case?  In particular, which of the following three files
(in C# syntax) would you want it to detect and why?

-- file1.cs --
Response.Write("alert('i pwnz u');");

-- file2.cs --
// In Javascript, we'd write this as function doit() { alert('hi'); }
void doit() { MessageBox.Show("hi"); }

-- file3.cs --
Response.Write("ale" + "rt (" + "'pw" + "ned" + "');");

Cheers,

- Peter


More information about the antlr-interest mailing list