Exemplo n.º 1
0
 /// <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);
 }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
 private void SetStyling(int length, SciStyleId style)
 {
     Sci.SetStyling(length, (int)style);
 }
Exemplo n.º 5
0
 public StyleThemeItem GetStyle(SciStyleId sciStyleId)
 {
     return(Items.ContainsKey(sciStyleId) ? Items[sciStyleId] : null);
 }