diff --git a/lexers/c/csharp.go b/lexers/c/csharp.go index d59fa4f..c6a5f46 100644 --- a/lexers/c/csharp.go +++ b/lexers/c/csharp.go @@ -13,6 +13,7 @@ var CSharp = internal.Register(MustNewLexer( Filenames: []string{"*.cs"}, MimeTypes: []string{"text/x-csharp"}, DotAll: true, + EnsureNL: true, }, Rules{ "root": { diff --git a/lexers/t/tradingview.go b/lexers/t/tradingview.go index e411411..1e64ab8 100644 --- a/lexers/t/tradingview.go +++ b/lexers/t/tradingview.go @@ -13,6 +13,7 @@ var TradingView = internal.Register(MustNewLexer( Filenames: []string{"*.tv"}, MimeTypes: []string{"text/x-tradingview"}, DotAll: true, + EnsureNL: true, }, Rules{ "root": { diff --git a/lexers/testdata/csharp.actual b/lexers/testdata/csharp.actual index 283f6d9..d30a0af 100644 --- a/lexers/testdata/csharp.actual +++ b/lexers/testdata/csharp.actual @@ -9,3 +9,5 @@ foreach (DriveInfo drive in drives) Console.WriteLine(dir); } } + +// Comment as last line should be recognised properly \ No newline at end of file diff --git a/lexers/testdata/csharp.expected b/lexers/testdata/csharp.expected index 6799e22..a2a4baa 100644 --- a/lexers/testdata/csharp.expected +++ b/lexers/testdata/csharp.expected @@ -69,5 +69,6 @@ {"type":"Punctuation","value":"}"}, {"type":"Text","value":"\n"}, {"type":"Punctuation","value":"}"}, - {"type":"Text","value":"\n"} + {"type":"Text","value":"\n\n"}, + {"type":"CommentSingle","value":"// Comment as last line should be recognised properly\n"} ] diff --git a/lexers/testdata/tradingview.actual b/lexers/testdata/tradingview.actual index 0bc340f..5447c47 100644 --- a/lexers/testdata/tradingview.actual +++ b/lexers/testdata/tradingview.actual @@ -10,3 +10,5 @@ plot(series=emaVal, style=circles, offset=2, linewidth=3) bgcolor(color=close > open ? orange : close != high[1] ? purple : na, transp=80) + +// Comment as last line should be recognised properly \ No newline at end of file diff --git a/lexers/testdata/tradingview.expected b/lexers/testdata/tradingview.expected index 58fe5cf..962e265 100644 --- a/lexers/testdata/tradingview.expected +++ b/lexers/testdata/tradingview.expected @@ -89,5 +89,7 @@ {"type":"Text","value":", transp"}, {"type":"KeywordPseudo","value":"="}, {"type":"LiteralNumber","value":"80"}, - {"type":"Text","value":")\n"} + {"type":"Text","value":")\n\n"}, + {"type":"CommentSingle","value":"// Comment as last line should be recognised properly"}, + {"type":"Text","value":"\n"} ]