• Products
  • Download
  • Purchase
  • Support
  • Company
Actipro Software company logo
Twitter Follow Actipro RSS Subscribe (RSS Feed)

The Actipro Blog

Tag Cloud

  • aero
  • blog
  • docking
  • editors
  • gauge
  • intelliprompt
  • navigation
  • propertygrid
  • ribbon
  • shared library
  • silverlight
  • syntaxeditor
  • themes
  • views
  • winforms
  • wpf

Latest Twitter News

November 21, 2011 at 11:14 AM
#WPF Studio 2011.2 is out now! Includes enhanced themes for native WPF conrtols and new SyntaxEditor features. http://t.co/uEMCaGPG

September 26, 2011 at 1:25 PM
If you'd like to see our #WPF / #Silverlight SyntaxEditor code editor control ported to Metro, provide feedback here: http://t.co/xXBNIDTi

September 15, 2011 at 8:31 PM
If you want to see SyntaxEditor eventually show up in Win8's #xaml UI, be sure to add your support to this MS thread: http://t.co/FBjz6TuC

August 15, 2011 at 1:47 PM
New SyntaxEditor IntelliPrompt parameter info feature docs/samples ready for the 2011.2 #WPF and #Silverlight releases. http://t.co/ezoYIjv

August 2, 2011 at 2:40 PM
First look at new automated IntelliPrompt parameter info coming to our C#/VB editor control in #WPF / #Silverlight http://t.co/CUz6O1T

Twitter Follow us on Twitter

Month List

  • 2012
    • February (2)
    • January (2)
  • 2011
    • December (2)
    • November (7)
    • October (2)
    • September (1)
    • August (5)
    • July (3)
    • June (6)
    • May (5)
    • April (8)
    • March (4)
    • February (5)
    • January (9)
  • 2010
    • December (9)
    • November (10)
    • October (4)
    • September (8)
    • August (12)
    • July (9)
    • June (7)
    • May (6)
    • April (7)
    • March (6)
    • February (6)
    • January (4)
  • 2009
    • December (2)
    • November (2)
    • October (12)
    • September (3)
    • August (11)
    • July (10)
    • June (6)
    • May (3)
    • April (7)
    • March (6)
    • February (8)
    • January (10)
  • 2008
    • December (10)
    • November (2)
    • October (3)
    • September (5)
    • August (5)
    • July (8)
    • June (4)
    • May (4)
    • April (10)
    • March (8)
    • February (1)
    • January (2)

Category List

  • RSS feed for ActiproActipro (288)
  • RSS feed for Blog SummaryBlog Summary (13)
  • RSS feed for GeneralGeneral (34)
  • RSS feed for In developmentIn development (149)
  • RSS feed for New featuresNew features (140)
  • RSS feed for New productNew product (30)
  • RSS feed for PromotionPromotion (2)
  • RSS feed for SilverlightSilverlight (71)
  • RSS feed for Tips and tricksTips and tricks (4)
  • RSS feed for Visual Studio 2008Visual Studio 2008 (2)
  • RSS feed for Windows FormsWindows Forms (19)
  • RSS feed for Windows VistaWindows Vista (10)
  • RSS feed for WPFWPF (235)
  • RSS feed for XAMLXAML (23)

About Us

Actipro Software is a leading provider of .NET user interface controls for the WPF, Silverlight, and WinForms frameworks, and is most well-known for their SyntaxEditor syntax-highlighting code editor control.

Please take some time to learn more about us and our product offerings.

SyntaxEditor for WPF’s MGrammar add-on adds AST construction and error reporting features

August 25, 2009 at 10:11 AM
by Bill Henning (Actipro)

SyntaxEditor for WPF, our syntax-highlighting code editor control, has just made some big improvements to the Oslo Dataflow (MGrammar) Add-on.  The enhancements include the ability to asynchronously parse text and return AST and syntax error results.  These updates appear in the latest WPF Studio build.

What is the Oslo Dataflow (MGrammar) Add-on?

The add-on is a free component that any SyntaxEditor for WPF customer can use.  It allows you to easily integrate parsers created via MGrammar with SyntaxEditor.  Previously, the add-on supported tokenization (lexing) and was able to drive syntax highlighting within the editor, all with just a few lines of code, as described in this previous post.

Parsing, AST construction, and error reporting

The add-on now includes a new DataflowParser class that implements IParser.  When registered with your language, documents using the language that are changed (generally by user typing) automatically log a request to have parsing done.  The parsing requests are queued and call back to the IParser on a worker thread.  At this point the IParser performs a parsing operation.  In the case of DataflowParser, the parsing operation is a call to Oslo’s DynamicParser.  Our DataflowParser then returns an object of type IDataflowParseData, which has a property containing the AST graph node result along with a list of IParseError objects, if any.  The IParseError objects indicate syntax errors that occurred during the parse.

MGrammarSample

The screenshot above shows the updated sample included with WPF Studio.  It now listens to the document’s ParseDataChanged event, which is an event that fires whenever the document’s ParseData property is updated.  From this event, we write out the AST in the pane on the right and list the errors, if any, on the bottom. 

Again, the parsing operation takes place on a worker thread, courtesy of our advanced parsing framework, and the result is returned asynchronously to the document’s ParseData property.  This ensures that the parsing doesn’t block the UI thread.

Enabling the new parsing features

One line of code added to the code described in this previous post enables all the multi-threaded functionality to parse your documents and update the ParseData property asynchronously:

   1: language.RegisterService<IParser>(new DataflowParser(parser));

What this does is register a new DataflowParser object as an IParser service with the language being used.  The parser variable in the code above is assumed to contain a DynamicParser instance, which is what is loaded from your MGrammar image.

Summary

With these recent updates, your MGrammar-based parsers can completely drive SyntaxEditor’s lexing, syntax highlighting, parsing, AST construction, and error reporting, all with just a few lines of code.  It’s now easier than ever to add a code editor to your WPF applications that integrate with your MGrammar DSLs.

Tags: wpf, syntaxeditor, mgrammar
Filed under: Actipro, New features, WPF
Submit to DotNetKicks...
Permalink | Comments (1)

Related posts

SyntaxEditor grammar/AST framework part 7: Adding error handling to the Simple grammarIn the previous post, we saw how the grammar framework supports callbacks nearly everywhere in the E...SyntaxEditor grammar/AST framework part 6: Introduction to callbacks and error handlingIn the previous post, we optimized the tree construction output of our Simple language to be very co...SyntaxEditor grammar/AST framework part 4: Introduction to customizing tree constructionIn the previous post of this series, we walked through how to create a grammar for the Simple langua...

Comments

September 29, 2009 at 15:41  

trackback

Actipro Blog 2009 Q3 posting summary

Actipro Blog 2009 Q3 posting summary

The Actipro Blog - WPF and WinForms Development

Comments are closed
Copyright © 1999-2012 Actipro Software LLC. All rights reserved.
Home Actipro Software | Products | Download | Contact Us