private TreeViewItem syntaxTokenItem(SyntaxToken _token) { TreeViewItem _item = new TreeViewItem(); _item.Header = SyntaxAnalyzeHelper.kindStr(_token.Kind()) + " " + SyntaxAnalyzeHelper.text(_token); _item.Background = Brushes.Beige; return(_item); }
private TreeViewItem syntaxNodeItem(SyntaxNode _syntaxNode) { TreeViewItem _item = new TreeViewItem(); string _header = SyntaxAnalyzeHelper.kindStr(_syntaxNode.Kind()); _item.Header = _header; _item.Background = Brushes.Aquamarine; _item.IsExpanded = true; return(_item); }
public void highlightTokens() { IEnumerator <SyntaxToken> _tokens = __compiler.tokens.GetEnumerator(); IEnumerable <INamedTypeSymbol> _classes = SyntaxAnalyzeHelper.classesInCompilation(__compiler.compilation); while (_tokens.MoveNext()) { SyntaxToken _token = _tokens.Current; string _text = SyntaxAnalyzeHelper.text(_token); if (_text == "") { continue; } if (SyntaxAnalyzeHelper.isKeyWord(_token)) { __hilights.Add(new Hilight(SyntaxAnalyzeHelper.positionInText(_token), _text.Length, HilightType.KEYWORD)); } else if (SyntaxAnalyzeHelper.isString(_token)) { __hilights.Add(new Hilight(SyntaxAnalyzeHelper.positionInText(_token), _text.Length, HilightType.STRING)); } else if (SyntaxAnalyzeHelper.isNumeric(_token)) { __hilights.Add(new Hilight(SyntaxAnalyzeHelper.positionInText(_token), _text.Length, HilightType.NUMBER)); } else if (SyntaxAnalyzeHelper.isMember(_token)) { __hilights.Add(new Hilight(SyntaxAnalyzeHelper.positionInText(_token), _text.Length, HilightType.MEMBER)); } else if (SyntaxAnalyzeHelper.isClassName_declaration(_token) || SyntaxAnalyzeHelper.isClassName(_token, __compiler.semanticModel)) { __hilights.Add(new Hilight(SyntaxAnalyzeHelper.positionInText(_token), _text.Length, HilightType.CLASSNAME)); } else { __hilights.Add(new Hilight(SyntaxAnalyzeHelper.positionInText(_token), _text.Length, HilightType.NOTHING)); } } hilightFunction.Invoke(__hilights); }
public void highlightTrivia() { IEnumerator <SyntaxTrivia> _trivias = __compiler.trivias.GetEnumerator(); while (_trivias.MoveNext()) { SyntaxTrivia _trivia = _trivias.Current; string _text = SyntaxAnalyzeHelper.text(_trivia); if (_text == "") { continue; } if (SyntaxAnalyzeHelper.isComment(_trivia)) { __hilights.Add(new Hilight(SyntaxAnalyzeHelper.positionInText(_trivia), _text.Length, HilightType.COMMENT)); } else { __hilights.Add(new Hilight(SyntaxAnalyzeHelper.positionInText(_trivia), _text.Length, HilightType.NOTHING)); } } hilightFunction.Invoke(__hilights); }