Skip to content

Commit

Permalink
Enable EnsureNL for TradingView and C# lexers
Browse files Browse the repository at this point in the history
  • Loading branch information
Jos512 authored and alecthomas committed Jan 23, 2019
1 parent abbe00c commit 8ce6ac6
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions lexers/c/csharp.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var CSharp = internal.Register(MustNewLexer(
Filenames: []string{"*.cs"},
MimeTypes: []string{"text/x-csharp"},
DotAll: true,
EnsureNL: true,
},
Rules{
"root": {
Expand Down
1 change: 1 addition & 0 deletions lexers/t/tradingview.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var TradingView = internal.Register(MustNewLexer(
Filenames: []string{"*.tv"},
MimeTypes: []string{"text/x-tradingview"},
DotAll: true,
EnsureNL: true,
},
Rules{
"root": {
Expand Down
2 changes: 2 additions & 0 deletions lexers/testdata/csharp.actual
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ foreach (DriveInfo drive in drives)
Console.WriteLine(dir);
}
}

// Comment as last line should be recognised properly
3 changes: 2 additions & 1 deletion lexers/testdata/csharp.expected
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
]
2 changes: 2 additions & 0 deletions lexers/testdata/tradingview.actual
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 3 additions & 1 deletion lexers/testdata/tradingview.expected
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
]

0 comments on commit 8ce6ac6

Please sign in to comment.