Example #1
0
        private static bool IsExplicitLineJoin(TrackingTokenInfo token, ITextSnapshot snapshot)
        {
            if (token.Category != TokenCategory.Operator)
            {
                return(false);
            }
            var t = token.GetText(snapshot);

            return(t == "\\" || t.TrimEnd('\r', '\n') == "\\");
        }
Example #2
0
        private static bool ShouldDedentAfterKeyword(TrackingTokenInfo token, ITextSnapshot snapshot)
        {
            if (token.Category != TokenCategory.Keyword)
            {
                return(false);
            }
            var keyword = token.GetText(snapshot);

            return(keyword == "pass" || keyword == "return" || keyword == "break" || keyword == "continue" || keyword == "raise");
        }
Example #3
0
        private static bool IsUnterminatedStringToken(TrackingTokenInfo token, ITextSnapshot snapshot)
        {
            if (token.Category == TokenCategory.IncompleteMultiLineStringLiteral)
            {
                return(true);
            }
            if (token.Category != TokenCategory.StringLiteral)
            {
                return(false);
            }

            try {
                var c = token.GetText(snapshot);
                return(c == "\"" || c == "'");
            } catch (ArgumentException) {
                return(false);
            }
        }
Example #4
0
 private static bool IsExplicitLineJoin(TrackingTokenInfo token, ITextSnapshot snapshot)
 {
     return(token.Category == TokenCategory.Operator && token.GetText(snapshot) == "\\");
 }