Re: [v8-users] Getting AST

2022-12-05 Thread Sabari Ravi
I have used it.But i get this error
Error: unrecognized flag --print-ast


On Monday, December 5, 2022 at 5:57:06 PM UTC+5:30 Ben Noordhuis wrote:

> On Mon, Dec 5, 2022 at 12:57 PM Sabari Ravi  wrote:
> >
> > Is there any method to get AST in v8? If so let me Know...
>
> --print-ast
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-users/cfa8087a-14ca-42b9-840f-522bf8f9f9fdn%40googlegroups.com.


[v8-users] Getting AST

2022-12-05 Thread Sabari Ravi
Is there any method to get AST in v8? If so let me Know... 

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-users/27ecd638-8e04-4752-96a0-7e160f018f2en%40googlegroups.com.


[v8-users] Re: Property Interceptors - anything similar for functions?

2009-07-17 Thread Ravi


Thanks Stephen!

On Jul 16, 4:30 pm, Stephan Beal sgb...@googlemail.com wrote:
 On Thu, Jul 16, 2009 at 9:56 PM, Ravi chinn...@yahoo.com wrote:

  Using Interceptors, is there anyway to figure out the arguments 'arg1'
  and 'arg2' on 'method1', or will I have to add a function callback
  after knowing (in the interceptor) that it's trying to invoke a method
  called 'method1'.

 The interceptors never see the arguments. The call:

 obj.method(arg1,arg2)

 is logically a few different parts:

 a) call interceptor for obj['method']. This part you can intercept in client
 code.
 b) Ensure that the property is-a callable type. If not, throw an error.
 c) Evaluate the arguments (in an unspecified order, AFAIK) and push them
 onto an arguments list.
 d) call the result of (a), passing it the arguments list.

 To intercept part (d) you have to (re)implement the function pointed to by
 obj.method.

 --
 - stephan bealhttp://wanderinghorse.net/home/stephan/
--~--~-~--~~~---~--~~
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
-~--~~~~--~~--~--~---



[v8-users] Script::Compile - issue with space in function argument;

2009-07-17 Thread Ravi

Hi,

I'm having an issue with passing string arguments with spaces in them
to function in java script. For example,
the following simple script throws an error on Script::Compile:

script language=JavaScriptfunction test(arg1,arg2){document.write
(arg1);};test(test Arg1,testArg2)/script

SyntaxError: Unexpected token ILLEGAL.

The error location is the space in test Arg1.

While, the below script without any space in the argument compiles and
runs fine:

script language=JavaScriptfunction test(arg1,arg2){document.write
(arg1);};test(testArg1,testArg2)/script


Please let me know if anyone has seen a similar issue, or if I need to
do additional steps before compiling script.

Thank you,
Ravi

--~--~-~--~~~---~--~~
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
-~--~~~~--~~--~--~---



[v8-users] Re: Script::Compile - issue with space in function argument;

2009-07-17 Thread Ravi



Also, this error seems to occur only when the function declaration and
the function call are in the same line. If I move the functio call
test(test Arg1, testArg2); to a new line, the compilation does
not fail. Could this be a small parser issue?

Thanks,
Ravi


On Jul 17, 3:40 pm, Ravi chinn...@yahoo.com wrote:
 Hi,

 I'm having an issue with passing string arguments with spaces in them
 to function in java script. For example,
 the following simple script throws an error on Script::Compile:

 script language=JavaScriptfunction test(arg1,arg2){document.write
 (arg1);};test(test Arg1,testArg2)/script

 SyntaxError: Unexpected token ILLEGAL.

 The error location is the space in test Arg1.

 While, the below script without any space in the argument compiles and
 runs fine:

 script language=JavaScriptfunction test(arg1,arg2){document.write
 (arg1);};test(testArg1,testArg2)/script

 Please let me know if anyone has seen a similar issue, or if I need to
 do additional steps before compiling script.

 Thank you,
 Ravi
--~--~-~--~~~---~--~~
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
-~--~~~~--~~--~--~---



[v8-users] Re: Script::Compile - issue with space in function argument;

2009-07-17 Thread Ravi


Please ignore this question. The issue I mentioned is coming from
another library (tidylib), it seems to be introducing some character
there while tidying up the html which I'm then passing to V8 engine.
Sorry if I've wasted anyone's time.

Thanks,
Ravi


On Jul 17, 4:02 pm, Ravi chinn...@yahoo.com wrote:
 Also, this error seems to occur only when the function declaration and
 the function call are in the same line. If I move the functio call
 test(test Arg1, testArg2); to a new line, the compilation does
 not fail. Could this be a small parser issue?

 Thanks,
 Ravi

 On Jul 17, 3:40 pm, Ravi chinn...@yahoo.com wrote:



  Hi,

  I'm having an issue with passing string arguments with spaces in them
  to function in java script. For example,
  the following simple script throws an error on Script::Compile:

  script language=JavaScriptfunction test(arg1,arg2){document.write
  (arg1);};test(test Arg1,testArg2)/script

  SyntaxError: Unexpected token ILLEGAL.

  The error location is the space in test Arg1.

  While, the below script without any space in the argument compiles and
  runs fine:

  script language=JavaScriptfunction test(arg1,arg2){document.write
  (arg1);};test(testArg1,testArg2)/script

  Please let me know if anyone has seen a similar issue, or if I need to
  do additional steps before compiling script.

  Thank you,
  Ravi- Hide quoted text -

 - Show quoted text -
--~--~-~--~~~---~--~~
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
-~--~~~~--~~--~--~---



[v8-users] Property Interceptors - anything similar for functions?

2009-07-16 Thread Ravi

Hi,

The property interceptors provide a way to handle any object property
with a callback. I was wondering if there is something similar to
handle any object method.

Thank you,
Ravi

--~--~-~--~~~---~--~~
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
-~--~~~~--~~--~--~---



[v8-users] Re: Property Interceptors - anything similar for functions?

2009-07-16 Thread Ravi


Thanks Stephan. Interceptors do seem to handle functions, but, I
couldn't figure out a way to access the function arguments. I wish
there were an example for such a scenario.

On Jul 16, 11:22 am, Stephan Beal sgb...@googlemail.com wrote:
 On Thu, Jul 16, 2009 at 5:06 PM, Ravi chinn...@yahoo.com wrote:
  The property interceptors provide a way to handle any object property
  with a callback. I was wondering if there is something similar to
  handle any object method.

 In theory, since a method is-a property, methods can also be handled via
 interceptors. i haven't tried it, but since JS does not syntactically
 differentiate between (a.b = c) based on the types of a.b and c, then
 interceptors should work on methods in the same way they work on
 non-method members.

 In theory, of course.

 --
 - stephan bealhttp://wanderinghorse.net/home/stephan/
--~--~-~--~~~---~--~~
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
-~--~~~~--~~--~--~---



[v8-users] Re: Property Interceptors - anything similar for functions?

2009-07-16 Thread Ravi


Thanks Dean.

The scenario I'm working on is: having a generic handler to capture
all the property and method calls on an object. For example, let's say
an object Obj is being used in javaScript, I'd like to capture and
record any operation on that Obj, like
var a = Obj.A
document.write(a)
Obj.method1(arg1, arg2);
Obj.b = 2;
.

Here, I do not know the names of Obj's properties/methods ahead. I'd
simply like to know that the script accessed Obj property 'A', invoked
'method1' on Obj with arguments 'arg1' and 'arg2', and set the
property 'b'.

Using Interceptors, is there anyway to figure out the arguments 'arg1'
and 'arg2' on 'method1', or will I have to add a function callback
after knowing (in the interceptor) that it's trying to invoke a method
called 'method1'.

Thank you.



On Jul 16, 11:49 am, Dean McNamee de...@chromium.org wrote:
 The interceptor just returns the function, you aren't calling the
 function.  The arguments come in when you call the function.



 On Thu, Jul 16, 2009 at 5:39 PM, Ravichinn...@yahoo.com wrote:

  Thanks Stephan. Interceptors do seem to handle functions, but, I
  couldn't figure out a way to access the function arguments. I wish
  there were an example for such a scenario.

  On Jul 16, 11:22 am, Stephan Beal sgb...@googlemail.com wrote:
  On Thu, Jul 16, 2009 at 5:06 PM, Ravi chinn...@yahoo.com wrote:
   The property interceptors provide a way to handle any object property
   with a callback. I was wondering if there is something similar to
   handle any object method.

  In theory, since a method is-a property, methods can also be handled via
  interceptors. i haven't tried it, but since JS does not syntactically
  differentiate between (a.b = c) based on the types of a.b and c, then
  interceptors should work on methods in the same way they work on
  non-method members.

  In theory, of course.

  --
  - stephan bealhttp://wanderinghorse.net/home/stephan/- Hide quoted 
  text -

 - Show quoted text -
--~--~-~--~~~---~--~~
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
-~--~~~~--~~--~--~---



[v8-users] Generic template to handle JS functions;

2009-07-14 Thread Ravi

Hi,

I was wondering if I could bind one C++ function to handle any member
functions of a particular object. For example, in the following JS
code:

var fs = new ActiveXObject('Scripting.FileSystemObject');
function f()
{
  fs.DeleteFile('c:\\ht.hta');
}

in order to handle the instantiation of 'ActiveXObject' and the
corresponding use of it's methods ('DeleteFile', etc.), I was
wondering if it would be possible to bind one C++ callback to all
member functions of the 'ActiveXObject'. The reason I'm trying to do
this is that the member functions of the 'ActiveXObject' instances
vary based on it's type, while I'm trying to simply hook into the JS
code and trace the calls in the script.

Any suggestions would be greatly appreciated.

Thanks,
Ravi



--~--~-~--~~~---~--~~
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
-~--~~~~--~~--~--~---