SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

Possible error in NRefactory when parsing C# code

Last post 10-02-2008 12:59 PM by Dan MAyer. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 10-02-2008 10:56 AM

    Possible error in NRefactory when parsing C# code

    Hi All,

    I'm trying to use NRefactory to parse some C# code to get the errors the user wrote and display them. But, some error messages that I get are on the wrong lines.

    I've used the NRefactoryDemo sample to test the behavior that I'm intersted in, and it displays the correct error message but on the wrong line.

    For example, if I delete the semi-colon char (";") at the end of the line "Console.Writeline("Hello, World!)" and I press the Parse C# Code button.

    An error messge is displayed saying that on line 8 column 3 a semi-colon ";" is expected. But, this is the wrong line and column.

    I've tried to debug the problem, but with no success. I get to the parser of Coco/R and their I can't continue.

    Is this the right behavior of NRefactory?

    I'm using SharpDevelop version 2.2.1.

    Thanks,

    Dan Mayer

  • 10-02-2008 12:35 PM In reply to

    Re: Possible error in NRefactory when parsing C# code

     line 8 column 3 is the position where NRefactory notices the parse error. And it's impossible to notice it any earlier, if (8/3) was a semi-colon instead of a closing brace, the syntax could be correct.

    The Microsoft C# compiler contains tons of custom logic that tries to detect what you probably wanted to write to provide more helpful error messages - but NRefactory doesn't have that.

    Daniel Grunwald
  • 10-02-2008 12:40 PM In reply to

    Re: Possible error in NRefactory when parsing C# code

    If I understand correctly, NRefactory uses a general parser and does not provide the ability to generate more accurate error messages.

    Do you know of any other free C# parser that porvide this functionalty.

    Thanks,

    Dan Mayer

  • 10-02-2008 12:55 PM In reply to

    Re: Possible error in NRefactory when parsing C# code

    That isn't related to "general parser" - accurate (MS-like) error messages require a lot of manual coding in the parser.

    You should take a look at the parser in Mono's C# compiler, I think it's capable of producing error messages very similar to the MS C# compiler.

    Daniel Grunwald
  • 10-02-2008 12:59 PM In reply to

    Re: Possible error in NRefactory when parsing C# code

    I'll check it. 

    Thanks for your help.

    Dan Mayer

Page 1 of 1 (5 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.