• 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 (3)
    • 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 (289)
  • RSS feed for Blog SummaryBlog Summary (13)
  • RSS feed for GeneralGeneral (34)
  • RSS feed for In developmentIn development (150)
  • 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 (20)
  • 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 Language Designer enhancements (part 5)

October 9, 2009 at 7:26 AM
by Bill Henning (Actipro)

In the previous post of this series we looked at how the New Dynamic Lexer Wizard generated a lexer for us that we could live test immediately.  In today’s post, we’ll look more in-depth at the dynamic lexer that was generated.

What is a dynamic lexer?

A dynamic lexer is a lexer that uses patterns to determine how to tokenize text.  Patterns can be explicit, which mean the pattern matches the exact characters in the pattern.  Patterns can also use regular expressions.  This allows for incredible flexibility that you won’t find in other products.  And remember that dynamic lexers are only one type of lexer that are supported in SyntaxEditor.

The wizard results in-depth

We use the treeview on the left to navigate the parts of the lexer.  In this screenshot, we have selected the Lexical States node.

DynLex1

All of the lexical states defined in the lexer are listed.  One or more can be selected and have its properties be edited directly in the property grid on the right.  Note that our wizard generated a default state along with states for strings and comments. 

DynLex2

The ribbon contains several buttons that may be used for modifying list selections.  In the screenshot above we have the mouse cursor over the Move Down button.  The Move Up and Move Down buttons allow you to reorder items in a list.  Ordering states and patterns properly in dynamic lexers is very important.

Now let’s click the Add button.

DynLex3

The Add Dynamic Lexical States dialog appears.  A similar dialog appears when adding other features like lexical macros.  In the dialog you enter one state key for each new lexical state you wish to create.  Pressing OK adds new states with the specified keys and then you use the property grid to configure them.

Now let’s cancel and click the Child States node of the Default state.

DynLex4

Here we see a list of references to other states that can be transitioned to from the default state.  Scopes are used to determine when states transition.  For instance, a string state will transition when a double-quote character is seen.

Next, let’s click on Pattern Groups.  This is where the meat of a lexer is.  Each pattern group defines one or more patterns that can be recognized.  The group can be designated as an explicit or regular expression pattern.  Whenever a pattern is matched against text, a specified token ID/key are assigned to the token that is created.  This token is also assigned a classification type key, which is used to drive syntax highlighting.

DynLex5

Pattern groups also can set their case sensitivity option (or inherit from parent) and can set various look-ahead and look-behind patterns that must be true for a pattern in the group to be matched.

Let’s right-click the Operator pattern group, which opens the Dynamic Lexical Patterns dialog.

DynLex6

This dialog gives us some high-level info about the pattern group being edited and lets us modify all its patterns.  You simply enter one pattern on each line and click OK to save.

Next let’s click on the Scopes node of the PrimaryString state.

DynLex7

Here we see the scope for the PrimaryString state.  It has a start and end pattern group.  The start pattern group says that this state is entered when a double quote is seen.  The end pattern group says this state is exited when a double-quote or line feed are seen.  This state also has its own other pattern groups we could modify by going to its Pattern Groups node.  Those pattern groups define how to tokenize text that is within the two double-quotes.

Next steps

Now that we have looked through what the wizard generated, our next post will focus on doing a project build, which does some really nice robust validation of our language project settings.

Tags: wpf, syntaxeditor
Filed under: Actipro, In development, WPF
Submit to DotNetKicks...
Permalink | Comments (1)

Related posts

SyntaxEditor for WPF Language Designer enhancements (part 1)Many customers of our WinForms and WPF SyntaxEditor controls have asked for an easy way to get start...SyntaxEditor for WPF Language Designer enhancements (part 2)This post is the second post in our series on upcoming enhancements to the SyntaxEditor for WPF Lang...SyntaxEditor for WPF Language Designer enhancements (part 7)In the previous post of this series we built the language project in the Language Designer, found th...

Comments

January 1, 2010 at 22:48  

trackback

Actipro Blog 2009 Q4 posting summary

Actipro Blog 2009 Q4 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