No error if method parameters are wrong

SyntaxEditor .NET Languages Add-on for WPF Forum

Posted 11 years ago by Christel
Version: 13.2.0592
Avatar

Hi,

 

SyntaxEditor .Net Languages with defined c#-Language File.

I write for example:

Console.Clear("122");

But this method should have no parameter. So the SyntaxEditor should provide an syntax error.

The same with other methods, where more parameters are in a method, than declared.

Does the SyntaxEditor provide this kind of method parameter parsing and error providing?

 

Thanks

Christel

Comments (8)

Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Christel,

Sorry but that isn't something our product will automatically provide since it's not a syntax error.  That is a compilation error, and is the type of thing that you'd need a compiler to report back to you.  If you have a C# compiler, you can piggyback it to the end of the parsing operation and append any compilation errors to the parse results.  That way, the squiggle lines will show up for it.


Actipro Software Support

Posted 10 years ago by Sören Kühnholz
Avatar

Hi,

is there a guideline how to do this? Or can you post a code example?

Thanks

Sören

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Sören,

Which syntax language are you trying to do this on?  Are you trying to add on a compiler's errors to our .NET Languages Add-on's parse data (I assume you have a C# compiler here?), or are you just trying to add some compiler errors onto one of your own custom language parser's results where you have full source for the parser?


Actipro Software Support

Posted 10 years ago by Sören Kühnholz
Avatar

Hi,

Thank you for the fast reply. I have a c# compiler and want to add compiler errors to the CSharpSyntaxLanguage of the .NET Language Addon.

[Modified 10 years ago]

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

All right, in that case you could make a class that inherits CSharpParser and override the Parse method.  In your override, call the base method and get its IParseData results.  Then run your compiler in the Parse method.

Make a new ILLParseData-based class that takes in the IParseData that you got from the base Parse method and wraps it, effectively returning all its properties back.  The only change is that the Errors property should combine the base IParseData's errors with the ones you get from your compiler.

Finally, register your new custom parse class using the RegisterParser extension method on your language.  Then you should be good to go.


Actipro Software Support

Posted 10 years ago by Sören Kühnholz
Avatar

Hello,

thank you for your reply. I tryed it out and it works fine. But I have an other problem now. As far as I register this parser, the intellisense doesn't work any longer. I use the header/footer functionality, All classes and variables defined in the header/footer are not shown.

Do you have any idea, what is wrong here?

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Sorry, I looked and might have an idea.  Instead of returning an ILLParseData-based class, make it IDotNetParseData-based.  That interface inherits ILLParseData.  There is some code in the add-on that looks specifically for a IDotNetParseData type instead of the core ILLParseData.  If you change to that, it should work.


Actipro Software Support

Posted 10 years ago by Sören Kühnholz
Avatar

It works perfectly fine. Thanks a lot. Great support.

The latest build of this product (v24.1.3) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.