1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-03-27 21:49:13 +02:00

Fixed newlines at end of C++ files.

Fixes #104.
This commit is contained in:
Alec Thomas 2018-02-08 12:24:27 +11:00
parent a35b8fe9bd
commit 205105fffc
3 changed files with 41 additions and 0 deletions

View File

@ -11,6 +11,7 @@ var CPP = Register(MustNewLexer(
Aliases: []string{"cpp", "c++"},
Filenames: []string{"*.cpp", "*.hpp", "*.c++", "*.h++", "*.cc", "*.hh", "*.cxx", "*.hxx", "*.C", "*.H", "*.cp", "*.CPP"},
MimeTypes: []string{"text/x-c++hdr", "text/x-c++src"},
EnsureNL: true,
},
Rules{
"statements": {

3
lexers/testdata/cpp.actual vendored Normal file
View File

@ -0,0 +1,3 @@
template <typename T>
void func(const std::string &s, const T &t) {
} // Do interesting things.

37
lexers/testdata/cpp.expected vendored Normal file
View File

@ -0,0 +1,37 @@
[
{"type":"Keyword","value":"template"},
{"type":"Text","value":" "},
{"type":"Operator","value":"\u003c"},
{"type":"Keyword","value":"typename"},
{"type":"Text","value":" "},
{"type":"Name","value":"T"},
{"type":"Operator","value":"\u003e"},
{"type":"Text","value":"\n"},
{"type":"KeywordType","value":"void"},
{"type":"Text","value":" "},
{"type":"Name","value":"func"},
{"type":"Punctuation","value":"("},
{"type":"Keyword","value":"const"},
{"type":"Text","value":" "},
{"type":"Name","value":"std"},
{"type":"Operator","value":"::"},
{"type":"Name","value":"string"},
{"type":"Text","value":" "},
{"type":"Operator","value":"\u0026"},
{"type":"Name","value":"s"},
{"type":"Punctuation","value":","},
{"type":"Text","value":" "},
{"type":"Keyword","value":"const"},
{"type":"Text","value":" "},
{"type":"Name","value":"T"},
{"type":"Text","value":" "},
{"type":"Operator","value":"\u0026"},
{"type":"Name","value":"t"},
{"type":"Punctuation","value":")"},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"{"},
{"type":"Text","value":"\n"},
{"type":"Punctuation","value":"}"},
{"type":"Text","value":" "},
{"type":"CommentSingle","value":"// Do interesting things.\n"}
]