On Aug 22, 10:27 am, Terry Braun <[EMAIL PROTECTED]> wrote:
> I'm probably misunderstanding what you need, but could you use JSON?
>
> europe72 wrote:
> > On Aug 20, 10:27 pm, Norris Boyd <[EMAIL PROTECTED]> wrote:
>
> >> On Aug 18, 11:09 am, europe72 <[EMAIL PROTECTED]> wrote:
>
> >>> Hello,
>
> >>> Does anyone know if there exists somewhere in the Rhino src regex to
> >>> correctly parse and split (into String[] or Object[]) parameters from
> >>> a String representation of afunctioncall? The regex would of course
> >>> need to take into account the fact that params are seperated by ",",
> >>> but also that a "," can seperate array values, can exist in strings
> >>> and can also seperate obj values etc..
>
> >>> If this regex exists somewhere that is great...otherwise I will post
> >>> it when I write it. But I would really prefer not to reinvent the
> >>> wheel on this one.
>
> >>> e.g.: test('mYstring\'\'\'s', 1e12 , ['A', 'B',
> >>> 'C'],'hello','blah \n aaa', {foo: [1], bar: 12345}) into String[] args
> >>> or Object[] args.
>
> >> No, there's no regexp for this in Rhino. We tokenize and parse with a
> >> recursive descent parser.
>
> >> --Norris
>
> > I have educated myself as to how Rhino parses JavaScript; reading some
> > posts by others and fiddling a bit. I understand the recursive descent
> > parsing generally but I have to say this feels harder then it should
> > be. Using Rhino as a JavaScript parser clearly requires *a lot* of
> > skill (and patience?). With that in mind...does ANYONE have some Java
> > code that they can share that extracts the parameters from a function
> > CALL and places them in a String[] or Object[]. I have seen code on
> > this forum for getting the params from a FUNCTION, but not a function
> > CALL.
> > _______________________________________________
> > dev-tech-js-engine-rhino mailing list
> > [EMAIL PROTECTED]
> >https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
Thanks for the reply. I actually tried that using the Java classes
available at json.org. There is a good tokenizer there as well as a
JSONObject and JSONArray class, but despite my best efforts I was
unable to consistently get a JSONObject or JSONArray from a parameter
list specified in a String function call. The syntax of a JSON string
and a parameter list don't line up exactly
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino