/// <summary> /// Is the caret not in : a string, a comment /// </summary> private static bool IsNormalContext(SciStyleId context) { return(context != SciStyleId.Comment && context != SciStyleId.DoubleQuote && context != SciStyleId.SimpleQuote && context != SciStyleId.SingleLineComment); }
public void Visit(TokenWord tok) { SciStyleId style = SciStyleId.Default; if (_includeDepth > 0) { style = SciStyleId.Include; } else { var existingKeywords = Keywords.Instance.GetKeywordsByName(tok.Value); if (existingKeywords != null && existingKeywords.Count > 0) { style = existingKeywords.First().KeywordSyntaxStyle; } // normed variables if (style == SciStyleId.Default) { var pos = tok.Value.IndexOf("_", StringComparison.CurrentCultureIgnoreCase); if (pos > 0 && tok.Value.Length >= pos + 1) { var prefix = tok.Value.Substring(0, pos + 1); if (NormedVariablesPrefixes.Contains(prefix)) { style = SciStyleId.NormedVariables; } } } } SetStyling(tok.EndPosition - tok.StartPosition, style); }
public void Visit(TokenSymbol tok) { SciStyleId style = SciStyleId.Default; if (_includeDepth > 0 && tok.Value == "}") { _includeDepth--; style = SciStyleId.Include; } else if (tok.EndPosition - tok.StartPosition == 1 && _operatorChars.Contains(tok.Value[0])) { style = SciStyleId.Operator; } SetStyling(tok.EndPosition - tok.StartPosition, style); }
private void SetStyling(int length, SciStyleId style) { Sci.SetStyling(length, (int)style); }
public StyleThemeItem GetStyle(SciStyleId sciStyleId) { return(Items.ContainsKey(sciStyleId) ? Items[sciStyleId] : null); }