summaryrefslogtreecommitdiffstats
path: root/contrib/python/Pygments/py3/pygments/lexers/diff.py
diff options
context:
space:
mode:
authororivej <[email protected]>2022-02-10 16:45:01 +0300
committerDaniil Cherednik <[email protected]>2022-02-10 16:45:01 +0300
commit2d37894b1b037cf24231090eda8589bbb44fb6fc (patch)
treebe835aa92c6248212e705f25388ebafcf84bc7a1 /contrib/python/Pygments/py3/pygments/lexers/diff.py
parent718c552901d703c502ccbefdfc3c9028d608b947 (diff)
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'contrib/python/Pygments/py3/pygments/lexers/diff.py')
-rw-r--r--contrib/python/Pygments/py3/pygments/lexers/diff.py114
1 files changed, 57 insertions, 57 deletions
diff --git a/contrib/python/Pygments/py3/pygments/lexers/diff.py b/contrib/python/Pygments/py3/pygments/lexers/diff.py
index c6cb9c71e43..a694bd68e6a 100644
--- a/contrib/python/Pygments/py3/pygments/lexers/diff.py
+++ b/contrib/python/Pygments/py3/pygments/lexers/diff.py
@@ -8,13 +8,13 @@
:license: BSD, see LICENSE for details.
"""
-import re
-
+import re
+
from pygments.lexer import RegexLexer, include, bygroups
from pygments.token import Text, Comment, Operator, Keyword, Name, Generic, \
Literal, Whitespace
-__all__ = ['DiffLexer', 'DarcsPatchLexer', 'WDiffLexer']
+__all__ = ['DiffLexer', 'DarcsPatchLexer', 'WDiffLexer']
class DiffLexer(RegexLexer):
@@ -105,60 +105,60 @@ class DarcsPatchLexer(RegexLexer):
(r'[^\n\[]+', Generic.Deleted),
],
}
-
-
-class WDiffLexer(RegexLexer):
- """
- A `wdiff <https://www.gnu.org/software/wdiff/>`_ lexer.
-
- Note that:
-
+
+
+class WDiffLexer(RegexLexer):
+ """
+ A `wdiff <https://www.gnu.org/software/wdiff/>`_ lexer.
+
+ Note that:
+
* It only works with normal output (without options like ``-l``).
* If the target files contain "[-", "-]", "{+", or "+}",
especially they are unbalanced, the lexer will get confused.
-
- .. versionadded:: 2.2
- """
-
- name = 'WDiff'
- aliases = ['wdiff']
- filenames = ['*.wdiff']
- mimetypes = []
-
- flags = re.MULTILINE | re.DOTALL
-
- # We can only assume "[-" after "[-" before "-]" is `nested`,
- # for instance wdiff to wdiff outputs. We have no way to
- # distinct these marker is of wdiff output from original text.
-
- ins_op = r"\{\+"
- ins_cl = r"\+\}"
- del_op = r"\[\-"
- del_cl = r"\-\]"
- normal = r'[^{}[\]+-]+' # for performance
- tokens = {
- 'root': [
- (ins_op, Generic.Inserted, 'inserted'),
- (del_op, Generic.Deleted, 'deleted'),
- (normal, Text),
- (r'.', Text),
- ],
- 'inserted': [
- (ins_op, Generic.Inserted, '#push'),
- (del_op, Generic.Inserted, '#push'),
- (del_cl, Generic.Inserted, '#pop'),
-
- (ins_cl, Generic.Inserted, '#pop'),
- (normal, Generic.Inserted),
- (r'.', Generic.Inserted),
- ],
- 'deleted': [
- (del_op, Generic.Deleted, '#push'),
- (ins_op, Generic.Deleted, '#push'),
- (ins_cl, Generic.Deleted, '#pop'),
-
- (del_cl, Generic.Deleted, '#pop'),
- (normal, Generic.Deleted),
- (r'.', Generic.Deleted),
- ],
- }
+
+ .. versionadded:: 2.2
+ """
+
+ name = 'WDiff'
+ aliases = ['wdiff']
+ filenames = ['*.wdiff']
+ mimetypes = []
+
+ flags = re.MULTILINE | re.DOTALL
+
+ # We can only assume "[-" after "[-" before "-]" is `nested`,
+ # for instance wdiff to wdiff outputs. We have no way to
+ # distinct these marker is of wdiff output from original text.
+
+ ins_op = r"\{\+"
+ ins_cl = r"\+\}"
+ del_op = r"\[\-"
+ del_cl = r"\-\]"
+ normal = r'[^{}[\]+-]+' # for performance
+ tokens = {
+ 'root': [
+ (ins_op, Generic.Inserted, 'inserted'),
+ (del_op, Generic.Deleted, 'deleted'),
+ (normal, Text),
+ (r'.', Text),
+ ],
+ 'inserted': [
+ (ins_op, Generic.Inserted, '#push'),
+ (del_op, Generic.Inserted, '#push'),
+ (del_cl, Generic.Inserted, '#pop'),
+
+ (ins_cl, Generic.Inserted, '#pop'),
+ (normal, Generic.Inserted),
+ (r'.', Generic.Inserted),
+ ],
+ 'deleted': [
+ (del_op, Generic.Deleted, '#push'),
+ (ins_op, Generic.Deleted, '#push'),
+ (ins_cl, Generic.Deleted, '#pop'),
+
+ (del_cl, Generic.Deleted, '#pop'),
+ (normal, Generic.Deleted),
+ (r'.', Generic.Deleted),
+ ],
+ }