public void TokenizeRdArguments04() { var actualTokens = Tokenize(@"\ifelse{{latex}{\out[x]{~}}{ }}{}", new RdTokenizer()); var expectedTokens = new[] { new TokenData <RdTokenType>(RdTokenType.Keyword, 0, 7), new TokenData <RdTokenType>(RdTokenType.OpenCurlyBrace, 7, 1), new TokenData <RdTokenType>(RdTokenType.OpenCurlyBrace, 8, 1), new TokenData <RdTokenType>(RdTokenType.CloseCurlyBrace, 14, 1), new TokenData <RdTokenType>(RdTokenType.OpenCurlyBrace, 15, 1), new TokenData <RdTokenType>(RdTokenType.Keyword, 16, 4), new TokenData <RdTokenType>(RdTokenType.OpenSquareBracket, 20, 1), new TokenData <RdTokenType>(RdTokenType.CloseSquareBracket, 22, 1), new TokenData <RdTokenType>(RdTokenType.OpenCurlyBrace, 23, 1), new TokenData <RdTokenType>(RdTokenType.CloseCurlyBrace, 25, 1), new TokenData <RdTokenType>(RdTokenType.CloseCurlyBrace, 26, 1), new TokenData <RdTokenType>(RdTokenType.OpenCurlyBrace, 27, 1), new TokenData <RdTokenType>(RdTokenType.CloseCurlyBrace, 29, 1), new TokenData <RdTokenType>(RdTokenType.CloseCurlyBrace, 30, 1), new TokenData <RdTokenType>(RdTokenType.OpenCurlyBrace, 31, 1), new TokenData <RdTokenType>(RdTokenType.CloseCurlyBrace, 32, 1), }; TokensCompare <RdTokenType, RdToken> .Compare(expectedTokens, actualTokens); }
public void TokenizeMd_Italic04() { var actualTokens = Tokenize(@"_italic_ text _a_b_c_", new MdTokenizer()); var expectedTokens = new[] { new TokenData <MarkdownTokenType>(MarkdownTokenType.Italic, 0, 8), new TokenData <MarkdownTokenType>(MarkdownTokenType.Italic, 14, 3), new TokenData <MarkdownTokenType>(MarkdownTokenType.Italic, 18, 3) }; TokensCompare <MarkdownTokenType, MarkdownToken> .Compare(expectedTokens, actualTokens); }
public void TokenizeMd_Bold01() { var actualTokens = Tokenize(@"**bold** text **a**b**c**", new MdTokenizer()); var expectedTokens = new[] { new TokenData <MarkdownTokenType>(MarkdownTokenType.Bold, 0, 8), new TokenData <MarkdownTokenType>(MarkdownTokenType.Bold, 14, 5), new TokenData <MarkdownTokenType>(MarkdownTokenType.Bold, 20, 5) }; TokensCompare <MarkdownTokenType, MarkdownToken> .Compare(expectedTokens, actualTokens); }
public void TokenizeMd_Monospace01() { var actualTokens = Tokenize(@"`italic` text `a`b`c`", new MdTokenizer()); var expectedTokens = new[] { new TokenData <MarkdownTokenType>(MarkdownTokenType.Monospace, 0, 8), new TokenData <MarkdownTokenType>(MarkdownTokenType.Monospace, 14, 3), new TokenData <MarkdownTokenType>(MarkdownTokenType.Monospace, 18, 3) }; TokensCompare <MarkdownTokenType, MarkdownToken> .Compare(expectedTokens, actualTokens); }
public void TokenizeRdArguments02() { var actualTokens = Tokenize(@"\method{as.matrix}{data.frame}(x)", new RdTokenizer()); var expectedTokens = new[] { new TokenData <RdTokenType>(RdTokenType.Keyword, 0, 7), new TokenData <RdTokenType>(RdTokenType.OpenCurlyBrace, 7, 1), new TokenData <RdTokenType>(RdTokenType.CloseCurlyBrace, 17, 1), new TokenData <RdTokenType>(RdTokenType.OpenCurlyBrace, 18, 1), new TokenData <RdTokenType>(RdTokenType.CloseCurlyBrace, 29, 1), }; TokensCompare <RdTokenType, RdToken> .Compare(expectedTokens, actualTokens); }
public void TokenizeCppFormatContent() { var actualTokens = Tokenize("\\usage{bmp(filename = \"Rplot%03d.jpg\", width = 480)}", new RdTokenizer(false)); actualTokens.Should().HaveCount(3); var expectedTokens = new[] { new TokenData <RdTokenType>(RdTokenType.Keyword, 0, 6), new TokenData <RdTokenType>(RdTokenType.OpenCurlyBrace, 6, 1), new TokenData <RdTokenType>(RdTokenType.CloseCurlyBrace, 51, 1) }; TokensCompare <RdTokenType, RdToken> .Compare(expectedTokens, actualTokens); }
public void TokenizeRdArguments05() { var actualTokens = Tokenize(@"\item{\dots}{ A }", new RdTokenizer()); var expectedTokens = new[] { new TokenData <RdTokenType>(RdTokenType.Keyword, 0, 5), new TokenData <RdTokenType>(RdTokenType.OpenCurlyBrace, 5, 1), new TokenData <RdTokenType>(RdTokenType.Keyword, 6, 5), new TokenData <RdTokenType>(RdTokenType.CloseCurlyBrace, 11, 1), new TokenData <RdTokenType>(RdTokenType.OpenCurlyBrace, 12, 1), new TokenData <RdTokenType>(RdTokenType.CloseCurlyBrace, 16, 1), }; TokensCompare <RdTokenType, RdToken> .Compare(expectedTokens, actualTokens); }
public void TokenizeMd_Mixed02() { var actualTokens = Tokenize(@"_italic **text** **a**b**c**_", new MdTokenizer()); var expectedTokens = new[] { new TokenData <MarkdownTokenType>(MarkdownTokenType.Italic, 0, 8), new TokenData <MarkdownTokenType>(MarkdownTokenType.BoldItalic, 8, 8), new TokenData <MarkdownTokenType>(MarkdownTokenType.Italic, 16, 1), new TokenData <MarkdownTokenType>(MarkdownTokenType.BoldItalic, 17, 5), new TokenData <MarkdownTokenType>(MarkdownTokenType.Italic, 22, 1), new TokenData <MarkdownTokenType>(MarkdownTokenType.BoldItalic, 23, 5), new TokenData <MarkdownTokenType>(MarkdownTokenType.Italic, 28, 1), }; TokensCompare <MarkdownTokenType, MarkdownToken> .Compare(expectedTokens, actualTokens); }
public void TokenizeMd_Mixed01() { var actualTokens = Tokenize(@"**bold _text_ *a*b_c_**", new MdTokenizer()); var expectedTokens = new[] { new TokenData <MarkdownTokenType>(MarkdownTokenType.Bold, 0, 7), new TokenData <MarkdownTokenType>(MarkdownTokenType.BoldItalic, 7, 6), new TokenData <MarkdownTokenType>(MarkdownTokenType.Bold, 13, 1), new TokenData <MarkdownTokenType>(MarkdownTokenType.BoldItalic, 14, 3), new TokenData <MarkdownTokenType>(MarkdownTokenType.Bold, 17, 1), new TokenData <MarkdownTokenType>(MarkdownTokenType.BoldItalic, 18, 3), new TokenData <MarkdownTokenType>(MarkdownTokenType.Bold, 21, 2), }; TokensCompare <MarkdownTokenType, MarkdownToken> .Compare(expectedTokens, actualTokens); }
public void TokenizeRdArguments03() { var actualTokens = Tokenize(@"\usage{\method{as.matrix}{data.frame}(x)}", new RdTokenizer()); var expectedTokens = new[] { new TokenData <RdTokenType>(RdTokenType.Keyword, 0, 6), new TokenData <RdTokenType>(RdTokenType.OpenCurlyBrace, 6, 1), new TokenData <RdTokenType>(RdTokenType.Keyword, 7, 7), new TokenData <RdTokenType>(RdTokenType.OpenCurlyBrace, 14, 1), new TokenData <RdTokenType>(RdTokenType.CloseCurlyBrace, 24, 1), new TokenData <RdTokenType>(RdTokenType.OpenCurlyBrace, 25, 1), new TokenData <RdTokenType>(RdTokenType.CloseCurlyBrace, 36, 1), new TokenData <RdTokenType>(RdTokenType.CloseCurlyBrace, 40, 1), }; TokensCompare <RdTokenType, RdToken> .Compare(expectedTokens, actualTokens); }
public void TokenizeRdArguments01() { var actualTokens = Tokenize(@"\a1{arg[text \a1[=a2]] text}", new RdTokenizer()); var expectedTokens = new[] { new TokenData <RdTokenType>(RdTokenType.Keyword, 0, 3), new TokenData <RdTokenType>(RdTokenType.OpenCurlyBrace, 3, 1), new TokenData <RdTokenType>(RdTokenType.OpenSquareBracket, 7, 1), new TokenData <RdTokenType>(RdTokenType.Keyword, 13, 3), new TokenData <RdTokenType>(RdTokenType.OpenSquareBracket, 16, 1), new TokenData <RdTokenType>(RdTokenType.CloseSquareBracket, 20, 1), new TokenData <RdTokenType>(RdTokenType.CloseSquareBracket, 21, 1), new TokenData <RdTokenType>(RdTokenType.CloseCurlyBrace, 27, 1), }; TokensCompare <RdTokenType, RdToken> .Compare(expectedTokens, actualTokens); }
public void TokenizeRdVerbationContent() { var actualTokens = Tokenize( @"\alias{\% \dots %foo} #ifdef %comment", new RdTokenizer()); var expectedTokens = new[] { new TokenData <RdTokenType>(RdTokenType.Keyword, 0, 6), new TokenData <RdTokenType>(RdTokenType.OpenCurlyBrace, 6, 1), new TokenData <RdTokenType>(RdTokenType.Keyword, 10, 5), new TokenData <RdTokenType>(RdTokenType.CloseCurlyBrace, 20, 1), new TokenData <RdTokenType>(RdTokenType.Pragma, 23, 6), new TokenData <RdTokenType>(RdTokenType.Comment, 31, 8), }; TokensCompare <RdTokenType, RdToken> .Compare(expectedTokens, actualTokens); }