private static IEnumerable <object[]> GetComplexTokenCombinations() { foreach (var kinds in Helper.GetAllPairs(TokenSamples.LexerTokenKinds)) { var specialCombination = GetSpecialTokenCombination(kinds.left, kinds.right); if (specialCombination == null) { continue; } foreach (var leftSample in TokenSamples.GetSamplesForKind(kinds.left)) { foreach (var rightSample in TokenSamples.GetSamplesForKind(kinds.right)) { // Block comments after a # are complicated as if the comment contains a newline, the bit // after the new line is no longer inside a comment. if ((kinds.left == SyntaxKind.HashToken || kinds.left == SyntaxKind.SingleLineCommentToken) && kinds.right == SyntaxKind.BlockCommentToken && (rightSample.Contains("\r") || rightSample.Contains("\n"))) { continue; } yield return(new object[] { leftSample, rightSample, specialCombination }); } } } }
private static IEnumerable <object[]> SingleTokens() { foreach (var kind in TokenSamples.LexerTokenKinds) { foreach (var sample in TokenSamples.GetSamplesForKind(kind)) { yield return(new object[] { kind, sample }); } } }
private static IEnumerable <object[]> GetSimpleTokenCombinations() { foreach (var kinds in Helper.GetAllPairs(TokenSamples.LexerTokenKinds)) { if (GetSpecialTokenCombination(kinds.left, kinds.right) != null) { continue; } foreach (var leftSample in TokenSamples.GetSamplesForKind(kinds.left)) { foreach (var rightSample in TokenSamples.GetSamplesForKind(kinds.right)) { yield return(new object[] { leftSample, rightSample, kinds.left, kinds.right }); } } } }