private static void AssertNextToken(nsCSSScanner lex, nsCSSTokenType type, Func<nsCSSToken, bool> condition) { var token = new nsCSSToken(); Assert.IsTrue(lex.Next(token, true), "Unexpected EOF"); Assert.AreEqual(type, token.mType); Assert.IsTrue(condition(token), "Condition for token {0} failed".Fmt(token.mType)); }
public IEnumerable<string> GetUris(string aInput) { var lexer = new nsCSSScanner(aInput, 1); var token = new nsCSSToken(); while (lexer.Next(token, true)) if (token.mType == nsCSSTokenType.URL) yield return token.mIdentStr; }
private static void AssertNextTokenEnd(nsCSSScanner lex) { var token = new nsCSSToken(); Assert.IsFalse(lex.Next(token, true), "Expected EOF"); }