Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Parsing Javascript using Rhino?

322 views
Skip to first unread message

javame_android

unread,
Oct 3, 2009, 2:38:17 AM10/3/09
to
Hi,

Can anyone let me know is it possible to parse any Javascript file
using Rhino? Is Rhino actually Javascript Parser which can parse any
JS file.

Hope to get a reply soon.


Thanks & Regards
Sunil

David Parks

unread,
Oct 3, 2009, 6:14:22 AM10/3/09
to dev-tech-js-...@lists.mozilla.org
Yes, Rhino parses and executes any javascript code. Rhino does *not* provide
any kind of API beyond the standard javascript functions, such as a DOM, for
example, that a browser would provide. Rhino parses and executes
javascript, you need to provide any APIs that the JS uses (or the JS code
can reference Java direction through a build in JS<->Java connector).
Hope that's of some help.
David

Hi,


Thanks & Regards
Sunil
_______________________________________________
dev-tech-js-engine-rhino mailing list
dev-tech-js-...@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

javame_android

unread,
Oct 3, 2009, 7:11:16 AM10/3/09
to
Hi,

Thanks a lot for replying.

It would be nice if you can guide me which class shall I use of Rhino
API to parse JS file. I am very new to Javascript, it would be really
nice if you can guide me to some example or even the class which can
let me parse JS file.

Will also go through the Rhino API, but if you can let me know then
that would be really helpful.


Thanks & Regards
Sunil

David Parks

unread,
Oct 3, 2009, 7:59:41 AM10/3/09
to dev-tech-js-...@lists.mozilla.org
Sure thing, but just to make sure I understand you correctly can you tell me
exactly the end result you are looking for? What are you trying to do with
Rhino (let's make sure we're talking about the same things).
Dave


-----Original Message-----
From:
dev-tech-js-engine-rhino-bounces+davidparks21=yaho...@lists.mozilla.org
[mailto:dev-tech-js-engine-rhino-bounces+davidparks21=yaho...@lists.mozill
a.org] On Behalf Of javame_android

Hi,


Thanks & Regards
Sunil

_______________________________________________

javame_android

unread,
Oct 5, 2009, 1:36:47 AM10/5/09
to
Hi,

What I want is, if suppose I give Rhino a javascript file then can it
return the output of a particular function. I mean to say if the
function performed some mathematical calculations then will that
return me the result in my java program.

If yes, then can you suggest the approach.

Thanks & Regards
Sunil

javame_android

unread,
Oct 5, 2009, 8:32:46 AM10/5/09
to
Hi,

I have managed to parse Javascript file. But, now the problem is that
it parses the file with only function in it. If there are two methods
or function in the Javascript file then it throws an exception.

So, can anyone let me know which method to call so that we provide the
method name and then that method of Javascript should be parsed and
result returned.

David Parks

unread,
Oct 10, 2009, 2:23:00 AM10/10/09
to dev-tech-js-...@lists.mozilla.org
Sorry not to reply sooner for you.
I'm not sure we are following exactly what you are doing. Can you post the
javascript and the code you are using to execute it?

A simple JS file such as (taken from the documentation example):

function f(x){return x+1} f(7)

should have no problem. What exception are you seeing? I imagine it is
unrelated to the fact that you have 2 functions defined in your javascript
and more likely due to some problem the JS its self (but that's just a blind
guess until we see what you see).

David


-----Original Message-----
From:
dev-tech-js-engine-rhino-bounces+davidparks21=yaho...@lists.mozilla.org
[mailto:dev-tech-js-engine-rhino-bounces+davidparks21=yaho...@lists.mozill
a.org] On Behalf Of javame_android
Sent: Monday, October 05, 2009 7:33 PM
To: dev-tech-js-...@lists.mozilla.org
Subject: Re: Parsing Javascript using Rhino?

Hi,


Thanks & Regards
Sunil

0 new messages