unable to get PatterGroups using TokenKey

SyntaxEditor for Windows Forms Forum

Posted 12 years ago by Karl Grambow
Avatar
Hi,

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
        Next

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?

Thanks,

Karl

Comments (2)

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
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 12 years ago by Karl Grambow
Avatar
Thanks,

I thought it would be something simple like that.

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

Add Comment

Please log in to a validated account to post comments.