Anybody got a simple SyntaxLanguage derived implementation?

SyntaxEditor for Windows Forms Forum

Posted 12 years ago by Kelly Leahy - Software Architect, Milliman
Version: 4.0.0244
Avatar
Does anybody have a simple SyntaxLanguage derived implementation of a very simplistic language that works with syntax highlighting correctly, and that they'd be willing to share?

I'm trying to get started on a SyntaxLanguage implementation, and am having a bunch of problems, so I thought if somebody had an example I could start from, I'd be good to go.

I don't need (nor do I want) a mergeable language or a dynamic language. I'm looking for anything based on SyntaxLanguage that perhaps has ID, Number, simple expressions and comments. That's enough for me to build on.

If someone would like to help give me the guidance I need to build such an example, I'd be happy to provide the complete example once it's finished, I just can't seem to get past several hurdles and I have so many things not working right, I don't know what questions to ask!

Kelly

Kelly Leahy Software Architect Milliman, USA

Comments (7)

Posted 12 years ago by Paul Fuller
Avatar
Kelly,

I was in a similar position a little while back. See my post titled 'Questions on SimpleLanguage example' of 12 November 2006.

There is some helpful information in the resulting discussion. The biggest help to me though was that Actipro support shared code from their CSharpSyntaxLanguage implementation. That is what cracked the nut for me. I don't know if they plan to make it publicly available but why wouldn't they? I'm just a regular customer and it got me going. Should be part of the help.

Also note that the class NonMergableTokenBase that helps greatly has been lifted from CSharpSyntaxLanguage and is now in the core product. That is an important part of the puzzle.

Regrettably I can't share my end result as it is for a commercial product. It also isn't that easy to lift out a self-contained bit of code from what is a largish project.

Suffice to say I plugged away and with the CSharpSyntaxLanguage example it all fell into place for me pretty quickly.

Hang in there because the other side of the learning curve is a nice place to be.

Paul
Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Kelly,

I just emailed you the internal sample code we have for C# that Paul mentioned, which should definitely get you going. We'll try and improve the docs and code to include a low-level sample like this in the future.

But if anyone else would like to post samples, that would be wonderful too!


Actipro Software Support

Posted 12 years ago by Werdna
Avatar
could I get some of that sample code too?
Posted 12 years ago by Kelly Leahy - Software Architect, Milliman
Avatar
I never did get this working... I'm still using a mergeable non-dynamic language.

Any chance we'll get an example soon? Can the example have more than one lexical scope / state?

Kelly Leahy Software Architect Milliman, USA

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Kelly,

We emailed you that C# sample a couple months ago. Did you get it?


Actipro Software Support

Posted 12 years ago by Kelly Leahy - Software Architect, Milliman
Avatar
Yes, I did. However, no matter what I did, I couldn't get it to work exactly the way I wanted it to. I'll see if I can set aside some time to give you an simple, but exact test case that has the same problems I was running into.

Mainly, I was having problems wherein the lexer could not recognize the final token in the document correctly. Even though the lexer was telling the "lexicalParseTarget" that the token was valid, the implementing class for lexicalParseTarget would not change the final token from an invalid token to the token I told it I found.

All that was before I even tried dealing with lexical contexts and stuff like that. This was just trying to get the lexer to work properly by itself.

I was just hoping you'd worked on a watered down example and fixed all the strange issues I was running into already ;)

Thanks,

Kelly Leahy Software Architect Milliman, USA

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Kelly,

Yes if you wouldn't mind, emailing over a simple project showing the problem would be the best course of action here. Thanks!


Actipro Software Support

The latest build of this product (v2018.1 build 0341) was released 7 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.