Parsing without the UI for unit tests

SyntaxEditor for Windows Forms Forum

Posted 17 years ago by Peter Chapman
Avatar
Actipro,

Somewhere on this forum I have read that it's possible to parse some text without using the syntax editor interface explicitly.

I would like to set up some unit tests where I can automatically parse some text, and check the contents of the compilation unit to see if my lexical and semantic parsers are operating correctly.

Any ideas?

TIA

Comments (2)

Posted 17 years ago by Kelly Leahy - Software Architect, Milliman
Avatar
You can create the Document class separate from the SyntaxEditor. If you turn off the semantic parser service in your unit test framework initialization, you'll get parsing that happens in the same thread that you set your Document's Text property.

If you've got your language and properties set right for SemanticParsingEnabled, etc., you should have a value in SemanticParseData once you've set your text.

I don't know whether all the outlining stuff actually happens with this, but you'll get most of your stuff.

Kelly

Kelly Leahy Software Architect Milliman, USA

Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Yes that is right. By disabling the service, semantic parsing will run in the same thread. Outlining and semantic parsing (along with tokens/lexical parse results) are all stored in Documents and Documents are independent of SyntaxEditor controls. So you can work with the Document standalone to get all this info.


Actipro Software Support

The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.