unable to get PatterGroups using TokenKey

SyntaxEditor for Windows Forms Forum

Posted 18 years ago by Karl Grambow

I'm using SyntaxEditor v3.1.210 with .net 1.1 on Win XP.

I'm attempting to find out whether a particular string exists as a pattern in a given pattern group. This is the code I'm using.

        Dim doc As New ActiproSoftware.SyntaxEditor.Document
        doc.LoadLanguageFromXml('language file in here)
        Dim language As SyntaxLanguage = doc.Language

        Dim state As LexicalState = language.DefaultLexicalState
        Dim patternGroups As LexicalPatternGroupCollection = state.LexicalPatternGroups

        Dim SystemTables As LexicalPatternGroup = patternGroups("SystemTables")'this returns nothing

        For Each table As LexicalPattern In SystemTables
            If table.Pattern = tablename Then Return True 'found the item

Now, where I try to get patternGroups("ReservedWord") it returns nothing but if I enter the index id for the patterngroup it returns the pattern group as expected, which ,if I look at, has a token key of "SystemTables".

I've tried the same with the beta of v4.0 and the same thing happens so perhaps I'm doing something wrong.

Is this a bug or is there another way I should be doing this?



Comments (2)

Posted 18 years ago by Actipro Software Support - Cleveland, OH, USA
I think the confusion is that there is a TokenKey attribute and Key attribute on the pattern group tags. The collections of pattern groups are indexed on Key, not TokenKey. And generally we don't populate the Key attribute in our definitions. So if you are trying to use the indexer like this, then fill in the Key attribute and it should work.

Actipro Software Support

Posted 18 years ago by Karl Grambow

I thought it would be something simple like that.

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

Add Comment

Please log in to a validated account to post comments.