thanks, but I still can't make it.

I Implemented my own CompilerSink and tried the following code:

SystemState state = new SystemState();
CompilerContext context = new CompilerContext(string.Empty, new MySink());
Parser parser = Parser.FromString(state, context, "some code with error");

but the AddError method was not called.



Dino Viehland wrote:
> 
> The FromFile and FromString methods are public static methods on the
> Parser class that create the Parser object.
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Ori
> Sent: Friday, August 03, 2007 10:46 AM
> To: users@lists.ironpython.com
> Subject: Re: [IronPython] Find the compile erros
> 
> 
> I still can't find how can I create a Parser, and I don't see the fuctions
> you mentioned: FromFile and FromString.
> 
> 
> Dino Viehland wrote:
>>
>> Sorry, these are a little scattered around the code base and (mostly)
>> live
>> outside the Hosting namespace.
>>
>> The Parser class is IronPython.Compiler.Parser, the CompilerContext is
>> IronPython.Compiler.CompilerContext, and the CompilerSink which you need
>> to derive from and override AddError is IronPython.Hosting.CompilerSink.
>>
>> -----Original Message-----
>> From: [EMAIL PROTECTED]
>> [mailto:[EMAIL PROTECTED] On Behalf Of Ori
>> Sent: Friday, August 03, 2007 10:35 AM
>> To: users@lists.ironpython.com
>> Subject: Re: [IronPython] Find the compile erros
>>
>>
>> I'm sorry but I couldn't find such methods. I'm using version 1.1.
>> Should I upgrade?
>>
>>
>> Dino Viehland wrote:
>>>
>>> You can use the Parser class directly for this (e.g. Parser.FromFile or
>>> Parser.FromString).  You just need to give it a CompilerContext which
>>> includes a CompilerSink object.  Your CompilerSink object will get
>>> called
>>> back w/ the errors.
>>>
>>> -----Original Message-----
>>> From: [EMAIL PROTECTED]
>>> [mailto:[EMAIL PROTECTED] On Behalf Of Ori
>>> Sent: Thursday, August 02, 2007 11:42 PM
>>> To: users@lists.ironpython.com
>>> Subject: [IronPython] Find the compile erros
>>>
>>>
>>> Hello,
>>>
>>> I'm using PythonEngine.Compile to compile code. The code I compile may
>>> contain errors and that's why I want to format the error(s). Currently
>>> I'm
>>> using try-catch and I work with the exception error text. Is there a
>>> btter
>>> way to get the compilation errors?
>>>
>>> Thanks,
>>> Ori
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Find-the-compile-erros-tf4210886.html#a11978230
>>> Sent from the IronPython mailing list archive at Nabble.com.
>>>
>>> _______________________________________________
>>> Users mailing list
>>> Users@lists.ironpython.com
>>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>>> _______________________________________________
>>> Users mailing list
>>> Users@lists.ironpython.com
>>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Find-the-compile-erros-tf4210886.html#a11987835
>> Sent from the IronPython mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> Users mailing list
>> Users@lists.ironpython.com
>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>> _______________________________________________
>> Users mailing list
>> Users@lists.ironpython.com
>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>>
>>
> 
> --
> View this message in context:
> http://www.nabble.com/Find-the-compile-erros-tf4210886.html#a11988015
> Sent from the IronPython mailing list archive at Nabble.com.
> 
> _______________________________________________
> Users mailing list
> Users@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> _______________________________________________
> Users mailing list
> Users@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Find-the-compile-erros-tf4210886.html#a11993930
Sent from the IronPython mailing list archive at Nabble.com.

_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to