diff options
author | Henrik Lievonen <henrik.lievonen@hotmail.com> | 2021-06-20 12:38:00 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-20 11:38:00 +0200 |
commit | fea1fbc0576bb9d6d1dc84ac8cc3825e0a4e5232 (patch) | |
tree | 33abbd215ef50ef061c455b2c3f8ee85f48aaaca /tests/examplefiles/cpp/example.cpp.output | |
parent | a65613e95462b0b75a46bf89d8270d4480d16e07 (diff) | |
download | pygments-git-fea1fbc0576bb9d6d1dc84ac8cc3825e0a4e5232.tar.gz |
Fix CFamilyLexer preprocessor tokenization errors (#1830)
CFamilyLexer failed to tokenize preprocessor macros when they were
preceded by line break surrounded by spaces. This was the case because
prerpocessor regex rule expected to start at the beginning of the line,
but the space regex rule matched also the whitespace after the line
break. Now the space rule has been refined not to match the line break.
Because of this, the preprocessor regex rule correctly matches
prerpocessor tokens even when they are preceded by white spaces, at the
cost of adding some more tokens in the token stream in some cases. This
change preserves the behavior of invalid preprocessor usage failing to
tokenize.
Diffstat (limited to 'tests/examplefiles/cpp/example.cpp.output')
-rw-r--r-- | tests/examplefiles/cpp/example.cpp.output | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/tests/examplefiles/cpp/example.cpp.output b/tests/examplefiles/cpp/example.cpp.output index aea47bec..0e88b682 100644 --- a/tests/examplefiles/cpp/example.cpp.output +++ b/tests/examplefiles/cpp/example.cpp.output @@ -11295,7 +11295,10 @@ ' ' Text '// BEGIN Content of ASBeautifier.cpp.BITFIELD.patch:\n' Comment.Single -' \n ' Text +' ' Text +'\n' Text + +' ' Text 'unsigned' Keyword.Type ' ' Text 'int' Keyword.Type @@ -11477,7 +11480,10 @@ '\t\t\t\t\t' Text '}' Punctuation -'\t\t\t\t\t\t\t\t\t\n\t\t\t\t' Text +'\t\t\t\t\t\t\t\t\t' Text +'\n' Text + +'\t\t\t\t' Text '}' Punctuation '\n' Text @@ -11528,7 +11534,10 @@ ' ' Text '// END Content of ASBeautifier.cpp.BITFIELD.patch:\n' Comment.Single -' \n ' Text +' ' Text +'\n' Text + +' ' Text '-' Operator '-' Operator 'tabCount' Name @@ -11722,7 +11731,10 @@ ' ' Text '}' Punctuation -' \n ' Text +' ' Text +'\n' Text + +' ' Text '// BEGIN content of ASBeautifier.cpp.BITFIELD.patch.bz2\n' Comment.Single ' ' Text @@ -11925,7 +11937,10 @@ '\t\t\t\t\t' Text '}' Punctuation -'\t\t\t\t\t\t\t\t\t\n\t\t\t\t' Text +'\t\t\t\t\t\t\t\t\t' Text +'\n' Text + +'\t\t\t\t' Text '}' Punctuation '\n' Text |