public void StarQueryTokenDefaultTest() { StarToken starToken = new StarToken(null); this.Assert.AreEqual(QueryTokenKind.Star, starToken.Kind, "The InternalKind property has an unexpected value."); this.Assert.IsNull(starToken.NextToken, "The NextToken property should be null."); }
public static StarToken ShouldBeStarToken(this QueryToken token) { Assert.NotNull(token); StarToken starToken = Assert.IsType <StarToken>(token); Assert.Equal(QueryTokenKind.Star, starToken.Kind); return(starToken); }
/// <summary> /// Write the star token as URI part to this builder. /// </summary> /// <param name="star">To write as URI part.</param> private void WriteStar(StarToken star) { ExceptionUtils.CheckArgumentNotNull(star, "star"); if (star.NextToken != null) { this.WriteQuery(star.NextToken); this.builder.Append(ExpressionConstants.SymbolForwardSlash); } this.builder.Append(UriQueryConstants.Star); }
/// <summary> /// Visits a StarToken /// </summary> /// <param name="tokenIn">The StarToken to bind</param> /// <returns>A QueryNode bound to this StarToken</returns> public virtual T Visit(StarToken tokenIn) { throw new NotImplementedException(); }
private static void VerifyStarQueryTokensAreEqual(StarToken expected, StarToken actual, AssertionHandler assert) { VerifyQueryTokensAreEqual(expected.NextToken, actual.NextToken, assert); }
public void NameIsAlwaysStar() { StarToken starToken = new StarToken(null); starToken.Identifier.Should().Be("*"); }
public void ParentIsSetCorrectly() { StarToken starToken = new StarToken(new LiteralToken(1)); starToken.NextToken.ShouldBeLiteralQueryToken(1); }
public void ParentCanBeNull() { StarToken starToken = new StarToken(null); starToken.NextToken.Should().BeNull(); }
public void ParentCanBeNull() { StarToken starToken = new StarToken(null); Assert.Null(starToken.NextToken); }
public List <Token> Convert(string regexString) { var result = new List <Token>(); var currentCharIndex = 0; var length = regexString.Length; while (currentCharIndex != length) { var currentChar = regexString[currentCharIndex]; Token toAdd; switch (currentChar) { case '(': toAdd = new LeftBracketToken(); break; case ')': toAdd = new RightBracketToken(); break; case '*': toAdd = new StarToken(); break; case '|': toAdd = new SumToken(); break; case '\\': currentCharIndex++; if (currentCharIndex == length) { throw new RegexParseException($"Backslash at the end of input escaping nothing."); } toAdd = new CharacterClassToken($"\\{regexString[currentCharIndex]}"); break; case '[': currentCharIndex++; var startingIndex = currentCharIndex; while (currentCharIndex != length && regexString[currentCharIndex] != ']') { // Escape inside character class if ('\\'.Equals(regexString[currentCharIndex])) { currentCharIndex++; } currentCharIndex++; } if (currentCharIndex == length) { throw new RegexParseException($"Character class not properly closed in {regexString}"); } var value = regexString.Substring(startingIndex, currentCharIndex - startingIndex); toAdd = new CharacterClassToken(value); break; default: toAdd = new CharacterClassToken($"\\{currentChar}"); break; } result.Add(toAdd); currentCharIndex++; } return(result); }
public void NameIsAlwaysStar() { StarToken starToken = new StarToken(null); Assert.Equal("*", starToken.Identifier); }
public Expression Visit(StarToken tokenIn) { throw new NotImplementedException(); }
public bool Visit(StarToken tokenIn) { throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, "QueryToken of type '{0}' is not supported.", tokenIn.Kind)); }