示例#1
0
 static string EscapeToken(string token, QueryTextDelimiterEscapeOptions requiredEscapeOptions, QueryTextDelimiterEscapeOptions currentEscapeOptions)
 {
     if (currentEscapeOptions.HasAll(requiredEscapeOptions))
     {
         return(Regex.Escape(token));
     }
     return(token);
 }
示例#2
0
        public QueryTextDelimiter(string openingToken, string closingToken, QueryTextDelimiterEscapeOptions escapeOptions)
        {
            this.escapeOptions = escapeOptions;
            this.openingToken  = openingToken;
            this.closingToken  = closingToken;

            escapedOpeningToken = EscapeToken(openingToken, QueryTextDelimiterEscapeOptions.EscapeOpening, escapeOptions);
            escapedClosingToken = EscapeToken(closingToken, QueryTextDelimiterEscapeOptions.EscapeClosing, escapeOptions);
        }
示例#3
0
 public static bool HasAll(this QueryTextDelimiterEscapeOptions flags, QueryTextDelimiterEscapeOptions all) => (flags & all) == all;
示例#4
0
 public static bool HasAny(this QueryTextDelimiterEscapeOptions flags, QueryTextDelimiterEscapeOptions f) => (flags & f) != 0;