Posted 19 years ago
by László Mohácsi
Hello!
I've tried the following : (in the OnTrigger handler)
SyntaxEditor editor = sender as SyntaxEditor;
SyntaxLanguage lan = editor.Document.Language;
LexicalPatternGroupCollection col = lan.LexicalStates["DefaultState"].LexicalPatternGroups;
string PatternText = null;
foreach (LexicalPatternGroup lp in col)
{
if ("ReservedWordToken" == lp.TokenKey)
{
foreach (LexicalPattern p in lp)
{
Console.WriteLine(p.Pattern);
PatternText = p.Pattern;
break;
}
}
}
string[] PatternList = PatternText.Split(" ", StringSplitOptions.None);
foreach (string s in PatternList){
Console.WriteLine("keyword=" + s);
}
But this only retrived the first word from the list. What am I missing here?
Second question would be how to add a keyword dynamically to this list ?
And if that's possible should Reparse be called ?
[Modified at 01/10/2006 01:46 PM]
I've tried the following : (in the OnTrigger handler)
SyntaxEditor editor = sender as SyntaxEditor;
SyntaxLanguage lan = editor.Document.Language;
LexicalPatternGroupCollection col = lan.LexicalStates["DefaultState"].LexicalPatternGroups;
string PatternText = null;
foreach (LexicalPatternGroup lp in col)
{
if ("ReservedWordToken" == lp.TokenKey)
{
foreach (LexicalPattern p in lp)
{
Console.WriteLine(p.Pattern);
PatternText = p.Pattern;
break;
}
}
}
string[] PatternList = PatternText.Split(" ", StringSplitOptions.None);
foreach (string s in PatternList){
Console.WriteLine("keyword=" + s);
}
But this only retrived the first word from the list. What am I missing here?
Second question would be how to add a keyword dynamically to this list ?
And if that's possible should Reparse be called ?
[Modified at 01/10/2006 01:46 PM]