in reply to Re(3): Regex for stripping variable names from a JavaScript file
in thread Regex for stripping variable names from a JavaScript file

Thank-you very much for leading me in the right direction... ++ to you. Just 2 days ago I didn't know anything about Parse:RecDescent... and now I wrote my first simple grammar to it... I don't know much about grammars, but I'm learning. That's why it's nice that someone can take a look at what I've done and give me pointers, etc.

One thing I haven't figured out, but now have some working code to play with, are the $return value 'stuff' (I was just guessing/hacking at it). Also, what you've done here does exactly what I want, return just the variable names (which I will use somewhere else in my code)... I'm not sure what you mean by missing "array_names" and "variables within parenthesized expressions", so I think I'll have a look into that as well.

I appreciate your time. What references do you use for this sort of thing? I've been reading the .pod files...

  • Comment on Re: Re(3): Regex for stripping variable names from a JavaScript file

Replies are listed 'Best First'.
Re (5): Regex for stripping variable names from a JavaScript file
by dmmiller2k (Chaplain) on Feb 27, 2002 at 16:35 UTC

    My pleasure. Actually, this is my first time using Parse::RecDescent, although I've written small grammars using bison. I didn't mean to actually solve your whole problem for you, just point you in the right direction.

    By 'missing' I was referring to the fact that in the following output, myTest, myTest1 and myTest2 are not picked up:

    var myTest9 = myTest[0], myTest10 = myTest[0]; ==> ( myTest9 myTest10 ) var myTest11 = (myTest1 == myTest2); ==> ( myTest11 )