diff --git a/Diff/Diff (Basic).sublime-syntax b/Diff/Diff (Basic).sublime-syntax
new file mode 100644
index 0000000000..8477936b41
--- /dev/null
+++ b/Diff/Diff (Basic).sublime-syntax
@@ -0,0 +1,190 @@
+%YAML 1.2
+---
+# This is the common base syntax for Gnu Diff and Git Diff,
+# which contains contexts, shared by both of them.
+# It is not designed as standalone syntax and therefore does not expose
+# anything when referenced or used directly.
+#
+# https://www.sublimetext.com/docs/syntax.html
+# https://www.gnu.org/software/diffutils/manual/diffutils.html
+scope: source.diff.basic
+version: 2
+hidden: true
+
+contexts:
+ main: []
+
+###[ HEADERS ]#################################################################
+
+ diff-header:
+ # https://www.gnu.org/software/diffutils/manual/diffutils.html#Detailed-Unified
+ - match: '{{bol}}(-{3})[ ](?!$)'
+ captures:
+ 1: punctuation.definition.from-file.diff
+ push: diff-header-unified-from-file
+ - match: '{{bol}}(\+{3})[ ](?!$)'
+ captures:
+ 1: punctuation.definition.to-file.diff
+ push: diff-header-unified-to-file
+
+ diff-header-unified-from-file:
+ - meta_scope: meta.diff.header.from-file meta.header.from-file.diff
+ - include: pop-eol
+ - include: dev-null
+ - include: path-separators
+ - include: timestamps
+ - include: diff-header-unified-file-comment
+
+ diff-header-unified-to-file:
+ - meta_scope: meta.diff.header.to-file meta.header.to-file.diff
+ - include: pop-eol
+ - include: dev-null
+ - include: path-separators
+ - include: timestamps
+ - include: diff-header-unified-file-comment
+
+ diff-header-unified-file-comment:
+ - match: \s+(\(.+\))$
+ captures:
+ 1: comment.block.diff
+
+###[ RANGES ]##################################################################
+
+ diff-line-ranges:
+ # https://www.gnu.org/software/diffutils/manual/diffutils.html#Detailed-Unified
+ - match: '{{bol}}(@@)(?=[^@\n]+@@(?:\s|$))'
+ captures:
+ 1: punctuation.definition.range.begin.diff
+ push: [hunk-name, inside-diff-line-ranges-unified]
+
+ inside-diff-line-ranges-unified:
+ - meta_scope: meta.diff.range.unified meta.range.unified.diff meta.toc-list.hunk.diff
+ - include: pop-eol
+ - match: \1
+ scope: punctuation.definition.range.end.diff
+ pop: 1
+ - include: line-range-span
+ - match: '[+-](?=\d)'
+ scope: support.function.diff
+
+ hunk-name:
+ - include: pop-eol
+ - match: '[ \t]+'
+ scope: meta.toc-list.hunk.diff
+ - match: \S.+?(?=\s*{{eol}})
+ scope: meta.toc-list.hunk.diff entity.name.section.diff
+
+ line-range-span:
+ - match: \d+(?:(,)\d+)?
+ captures:
+ 1: punctuation.separator.sequence.diff
+
+###[ DELTAS ]##################################################################
+
+ diff-deltas:
+ # https://www.gnu.org/software/diffutils/manual/diffutils.html#Example-Unified
+ - match: '{{bol}}\+'
+ scope: punctuation.definition.inserted.diff
+ push: line-inserted
+ - match: '{{bol}}-'
+ scope: punctuation.definition.deleted.diff
+ push: line-deleted
+ - include: incomplete-line
+
+ # https://www.gnu.org/software/diffutils/manual/diffutils.html#Incomplete-Lines
+ incomplete-line:
+ - match: '{{bol}}[\\/]'
+ scope: punctuation.definition.comment.begin.diff
+ push: line-ignored
+
+ line-deleted:
+ - meta_scope: markup.deleted.diff
+ - include: pop-eol
+ - include: trailing-whitespace
+
+ line-inserted:
+ - meta_scope: markup.inserted.diff
+ - include: pop-eol
+ - include: trailing-whitespace
+
+ line-changed:
+ - meta_scope: markup.changed.diff
+ - include: pop-eol
+ - include: trailing-whitespace
+
+ line-ignored:
+ - meta_scope: comment.line.diff
+ - include: pop-eol
+ - include: trailing-whitespace
+
+ trailing-whitespace:
+ - match: '[ \t]*$'
+ scope: meta.whitespace.trailing.diff
+
+###[ COMPONENTS ]##############################################################
+
+ dev-null:
+ - match: /dev/null\b
+ scope: constant.language.null.diff
+
+ path-separators:
+ - match: /|\\
+ scope: punctuation.separator.path.diff
+ - match: \B\.\.(?=/|\\)
+ scope: constant.other.path.parent.diff
+ - match: \B\.(?=/|\\)
+ scope: constant.other.path.self.diff
+
+ timestamps:
+ # 1970-01-01 00:00:00 +0000
+ - match: \b1970(-)01(-)01 0?0(:)00(:)00(?:(\.)0+)?(?:[ ]([+-]?0000|UTC))?
+ scope: meta.date.diff constant.language.null.diff
+ captures:
+ 1: punctuation.separator.date.diff
+ 2: punctuation.separator.date.diff
+ 3: punctuation.separator.date.diff
+ 4: punctuation.separator.date.diff
+ 5: punctuation.separator.decimal.diff
+ 6: storage.modifier.diff
+
+ # 2002-02-21 23:30:50.442260588 -0800
+ - match: \b\d{4}(-)\d\d(-)\d\d \d?\d(:)\d\d(:)\d\d(?:(\.)\d+)?(?:[ ]([+-]?\d{4}))?
+ scope: meta.date.diff meta.number.integer.decimal.diff constant.numeric.value.diff
+ captures:
+ 1: punctuation.separator.date.diff
+ 2: punctuation.separator.date.diff
+ 3: punctuation.separator.date.diff
+ 4: punctuation.separator.date.diff
+ 5: punctuation.separator.decimal.diff
+ 6: storage.modifier.diff
+
+###[ PROTOTYPES ]##############################################################
+
+ pop-immediately:
+ - match: ''
+ pop: 1
+
+ pop-eol:
+ - match: '{{eol}}'
+ pop: 1
+
+ pop-before-eol:
+ - match: $
+ pop: 1
+
+###############################################################################
+
+variables:
+ git_hash40: '[0-9a-fA-F]{40}'
+ git_hash64: '[0-9a-fA-F]{64}'
+ git_hash_full: (?:{{git_hash64}}|{{git_hash40}})
+ git_first_line: |-
+ {{bol}}(?x:
+ From [ ] \w+@z [ ]
+ Thu [ ] Jan [ ]{2} 1 [ ] 00:00:00 [ ] 1970 # git-send-email
+ | From [ ] {{git_hash_full}} [ ]
+ Mon [ ] Sep [ ] 17 [ ] 00:00:00 [ ] 2001 # git-format-patch
+ )
+ # No whitespace at beginning of line, unless overridden
+ bol: ^
+ eol: (?:$\n?)
diff --git a/Diff/Diff.sublime-syntax b/Diff/Diff.sublime-syntax
index 2856da0f85..2494d28bd3 100644
--- a/Diff/Diff.sublime-syntax
+++ b/Diff/Diff.sublime-syntax
@@ -1,75 +1,349 @@
%YAML 1.2
---
-# http://www.sublimetext.com/docs/3/syntax.html
+# https://www.sublimetext.com/docs/syntax.html
+# https://www.gnu.org/software/diffutils/manual/diffutils.html
name: Diff
+scope: source.diff
+version: 2
+
+extends: Diff (Basic).sublime-syntax
+
file_extensions:
- diff
- patch
+
first_line_match: |-
- (?x)^
- (===\ modified\ file
- |==== \s* // .+ \s - \s .+ \s+ ====
- |Index:[ ]
- |---\ [^%]
- |\*\*\*.*\d{4}\s*$
- |\d+(,\d+)* (a|d|c) \d+(,\d+)* $
- |diff\ --git[ ]
- )
+ ^(?x:
+ ===\ modified\ file
+ | ==== \s* // .+ \s - \s .+ \s+ ====
+ | Index:[ ]
+ | Prereq:[ ]
+ | ---\ [^%]
+ | \*\*\*.*\d{4}\s*$
+ | \d+(,\d+)* [adc] \d+(,\d+)* $
+ )
-scope: source.diff
contexts:
main:
- - match: '^((\*{15})|(={67})|(-{3}))$\n?'
+ - match: (?={{git_first_line}})
+ embed: Packages/Git Formats/Git Diff.sublime-syntax#email-first-line
+ escape: (?!)
+ # Hack for unit tests
+ - include: incomplete-line
+ - match: ^
+ push: diffs
+
+ diffs:
+ - include: diff-line-ranges
+ - include: diff-header
+ - include: conflicts
+ - include: diff-deltas
+ - include: diff3-edit
+ - include: diff3-normal
+ - include: side-by-side
+
+###[ HEADERS ]#################################################################
+
+ diff-header:
+ - meta_prepend: true
+ # https://www.gnu.org/software/diffutils/manual/diffutils.html#Detailed-Context
+ - match: '{{bol}}(\*{15}){{eol}}'
scope: meta.separator.diff
captures:
- 1: punctuation.definition.separator.diff
- - match: ^\d+(,\d+)*(a|d|c)\d+(,\d+)*$\n?
- scope: meta.diff.range.normal meta.range.normal.diff
- - match: ^(@@)\s*(.+?)\s*(@@)\s*(.*?)\s*$\n?
- scope: meta.diff.range.unified meta.range.unified.diff
- captures:
- 1: punctuation.definition.range.diff
- 2: meta.toc-list.line-number.diff
- 3: punctuation.definition.range.diff
- 4: entity.name.section.diff
- - match: '^(((\-{3}) .+ (\-{4}))|((\*{3}) .+ (\*{4})))$\n?'
- scope: meta.diff.range.context meta.range.context.diff
- captures:
- 3: punctuation.definition.range.diff
- 4: punctuation.definition.range.diff
- 6: punctuation.definition.range.diff
- 7: punctuation.definition.range.diff
- - match: '(^(((-{3}) .+)|((\*{3}) .+))$\n?|^(={4}) .+(?= - ))'
+ 1: punctuation.separator.block.diff
+ - match: '{{bol}}(\*{3})[ ](?!$)'
+ captures:
+ 1: punctuation.definition.from-file.diff
+ push: diff-header-context-from-file
+
+ # https://svnbook.red-bean.com/en/1.7/svn-book.html#svn.ref.svn.c.patch
+ - match: '{{bol}}(={67}|={78}|_{67}){{eol}}'
+ scope: meta.separator.diff
+ captures:
+ 1: punctuation.separator.block.diff
+
+ # File headers from extensions and SVN
+ - match: |-
+ {{bol}}(?x:(
+ Added | Copied | Deleted | Index | Modified
+ | Prereq | Property [ ] changes [ ] on
+ ))(:)[ \t]*
+ captures:
+ 1: meta.mapping.key.diff keyword.other.diff
+ 2: punctuation.separator.key-value.diff
+ push: diff-header-index-file-body
+
+ # Can't find documentation for these "="-formatted headers, but there
+ # are preexisting unit tests.
+ - match: '{{bol}}(={4}) .+(?= - )'
scope: meta.diff.header.from-file meta.header.from-file.diff
captures:
- 4: punctuation.definition.from-file.diff
- 6: punctuation.definition.from-file.diff
- 7: punctuation.definition.from-file.diff
- - match: '(^(\+{3}) .+$\n?| (-) .* (={4})$\n?)'
- scope: meta.diff.header.to-file meta.header.to-file.diff
+ 1: punctuation.definition.from-file.diff
+ push: diff-header-4equals-body
+
+ diff-header-index-file-body:
+ - meta_scope: meta.mapping.diff meta.diff.index meta.index.diff
+ - meta_content_scope: meta.mapping.value.diff meta.toc-list.file-name.diff
+ - include: pop-eol
+ - include: path-separators
+
+ diff-header-4equals-body:
+ - match: ( (-) )(.* (={4})){{eol}}
captures:
- 2: punctuation.definition.to-file.diff
- 3: punctuation.definition.to-file.diff
+ 1: meta.header.diff
+ 2: punctuation.separator.range.diff
+ 3: meta.diff.header.to-file meta.header.to-file.diff
4: punctuation.definition.to-file.diff
- - match: ^(?:(>)(?:\ .*?)?|(\+).*?)(\s*?)$\n?
- scope: markup.inserted.diff
+ pop: 1
+ - include: pop-immediately
+
+ diff-header-context-from-file:
+ - meta_scope: meta.diff.header.from-file meta.header.from-file.diff
+ - match: '{{eol}}'
+ set: maybe-diff-header-context-to-file
+ - include: dev-null
+ - include: path-separators
+ - include: timestamps
+
+ maybe-diff-header-context-to-file:
+ - match: '{{bol}}(-{3})[ ](?!$)'
captures:
- 1: punctuation.definition.inserted.diff
- 2: punctuation.definition.inserted.diff
- 3: meta.whitespace.trailing.diff
- - match: ^(!).*?(\s*?)$\n?
- scope: markup.changed.diff
+ 1: punctuation.definition.to-file.diff
+ push: diff-header-context-to-file
+ - match: ^
+ pop: 1
+
+ diff-header-context-to-file:
+ - meta_scope: meta.diff.header.to-file meta.header.to-file.diff
+ - include: pop-eol
+ - include: dev-null
+ - include: path-separators
+ - include: timestamps
+
+###[ RANGES ]##################################################################
+
+ diff-line-ranges:
+ - meta_prepend: true
+ # https://www.gnu.org/software/diffutils/manual/diffutils.html#Hunks
+ - match: '{{bol}}-{3}{{eol}}'
+ scope: meta.separator.diff punctuation.separator.block.diff
+ - match: '{{bol}}\d+(?:(,)\d+)*(a|d|c)\d+(?:(,)\d+)*{{eol}}'
+ scope: meta.diff.range.normal meta.range.normal.diff
+ captures:
+ 1: punctuation.separator.range.diff
+ 2: support.function.diff
+ 3: punctuation.separator.range.diff
+
+ # https://www.gnu.org/software/diffutils/manual/diffutils.html#Example-Context
+ - match: '{{bol}}(-){3}(?= .+ -{4}{{eol}})'
+ scope: punctuation.definition.range.begin.diff
+ push: inside-diff-line-ranges-context
+ - match: '{{bol}}(\*){3}(?= .+ \*{4}{{eol}})'
+ scope: punctuation.definition.range.begin.diff
+ push: inside-diff-line-ranges-context
+
+ inside-diff-line-ranges-context:
+ - meta_scope: meta.diff.range.context meta.range.context.diff meta.toc-list.hunk.diff
+ - include: pop-eol
+ - match: \1{4}
+ scope: punctuation.definition.range.end.diff
+ pop: 1
+ - include: line-range-span
+
+###[ DELTAS ]##################################################################
+
+ diff-deltas:
+ - meta_prepend: true
+ # https://www.gnu.org/software/diffutils/manual/diffutils.html#Example-Normal
+ - match: '{{bol}}> ?'
+ scope: punctuation.definition.inserted.diff
+ push: line-inserted
+ - match: '{{bol}}< ?'
+ scope: punctuation.definition.deleted.diff
+ push: line-deleted
+
+ # https://www.gnu.org/software/diffutils/manual/diffutils.html#Example-Context
+ - match: '{{bol}}\+ ?'
+ scope: punctuation.definition.inserted.diff
+ push: line-inserted
+ - match: '{{bol}}- ?'
+ scope: punctuation.definition.deleted.diff
+ push: line-deleted
+ - match: '{{bol}}! ?'
+ scope: punctuation.definition.changed.diff
+ push: line-changed
+
+###[ DIFF3 ]###################################################################
+
+ # https://www.gnu.org/software/diffutils/manual/diffutils.html#Example-diff3-Normal
+ diff3-normal:
+ - match: '{{bol}}====([1-3]?){{eol}}'
+ scope: meta.hunk.diff punctuation.section.hunk.diff
+ captures:
+ 1: constant.numeric.from-file.diff
+
+ - match: '{{bol}}(([1-3])(:)(?:\d+(a)|\d+(?:(,)\d+)?(c))){{eol}}'
+ scope: meta.diff.range.normal meta.range.normal.diff
captures:
- 1: punctuation.definition.changed.diff
- 2: meta.whitespace.trailing.diff
- - match: ^(?:(<)(?:\ .*?)?|(-).*?)(\s*?)$\n?
- scope: markup.deleted.diff
+ 1: meta.toc-list.hunk.diff
+ 2: constant.numeric.from-file.diff
+ 3: punctuation.separator.file.diff
+ 4: support.function.diff
+ 5: punctuation.separator.range.diff
+ 6: support.function.diff
+ push: diff3-normal-change
+
+ diff3-normal-change:
+ - meta_scope: meta.hunk.diff
+ - meta_content_scope: meta.block.diff
+ - match: '{{bol}}(?:\t| )'
+ push: line-changed
+ - match: '{{bol}}'
+ pop: 1
+
+ # https://www.gnu.org/software/diffutils/manual/diffutils.html#Selecting-Which-Changes-to-Incorporate
+ diff3-edit:
+ - match: '{{bol}}(\d+)(a){{eol}}'
+ captures:
+ 1: meta.diff.range.normal meta.range.normal.diff
+ 2: support.function.diff
+ push: diff3-edit-inserted
+
+ - match: '{{bol}}(\d+)(d){{eol}}'
+ captures:
+ 1: meta.diff.range.normal meta.range.normal.diff
+ 2: support.function.diff
+ push: diff3-edit-deleted
+
+ - match: '{{bol}}(\d+)(c){{eol}}'
+ captures:
+ 1: meta.diff.range.normal meta.range.normal.diff
+ 2: support.function.diff
+ push: diff3-edit-changed
+
+ diff3-edit-inserted:
+ - meta_scope: meta.hunk.diff
+ - meta_content_scope: meta.block.diff markup.inserted.diff
+ - include: diff3-edit-end
+
+ diff3-edit-deleted:
+ - meta_scope: meta.hunk.diff
+ - meta_content_scope: meta.block.diff markup.deleted.diff
+ - include: diff3-edit-end
+
+ diff3-edit-changed:
+ - meta_scope: meta.hunk.diff
+ - meta_content_scope: meta.block.diff markup.changed.diff
+ - include: diff3-edit-end
+
+ diff3-edit-end:
+ - match: '{{bol}}\.$'
+ scope: punctuation.terminator.hunk.diff
+ pop: 1
+
+###[ CONFLICTS ]###############################################################
+
+ # Utility context for other files to use
+ conflict-markers:
+ - match: '{{bol}}({{conflict_begin}})(?:\s*({{conflict_identifier}}))?{{eol}}'
+ scope: meta.block.conflict.begin.diff
+ captures:
+ 1: punctuation.section.block.begin.diff
+ 2: entity.name.section.diff
+ - match: '{{bol}}({{conflict_end}})(?:\s*({{conflict_identifier}}))?{{eol}}'
+ scope: meta.block.conflict.end.diff
+ captures:
+ 1: punctuation.section.block.end.diff
+ 2: entity.name.section.diff
+ - match: '{{bol}}({{conflict_base}}|{{conflict_split}})(?:\s*({{conflict_identifier}}))?{{eol}}'
+ scope: meta.block.conflict.separator.diff
+ captures:
+ 1: punctuation.section.block.diff
+ 2: entity.name.section.diff
+
+ conflicts:
+ - match: '{{bol}}({{conflict_begin}})(?:\s*({{conflict_identifier}}))?{{eol}}'
+ scope: meta.block.conflict.begin.diff
+ captures:
+ 1: punctuation.section.block.begin.diff
+ 2: entity.name.section.diff
+ push: conflict-deleted-lines
+
+ conflict-deleted-lines:
+ - meta_content_scope: meta.block.conflict.diff markup.deleted.diff
+ - match: '{{bol}}({{conflict_base}})(?:\s*({{conflict_identifier}}))?{{eol}}'
+ scope: meta.block.conflict.separator.diff
+ captures:
+ 1: punctuation.section.block.diff
+ 2: entity.name.section.diff
+ set: conflict-base-lines
+ - include: conflict-base-lines
+
+ conflict-base-lines:
+ - meta_content_scope: meta.block.conflict.diff comment.block.diff
+ - match: '{{bol}}({{conflict_split}})(?:\s*({{conflict_identifier}}))?{{eol}}'
+ scope: meta.block.conflict.separator.diff
+ captures:
+ 1: punctuation.section.block.diff
+ 2: entity.name.section.diff
+ set: conflict-new-lines
+ - include: invalid-conflict-marker
+
+ conflict-new-lines:
+ - meta_content_scope: meta.block.conflict.diff markup.inserted.diff
+ - match: '{{bol}}({{conflict_end}})(?:\s*({{conflict_identifier}}))?{{eol}}'
+ scope: meta.block.conflict.end.diff
+ captures:
+ 1: punctuation.section.block.end.diff
+ 2: entity.name.section.diff
+ pop: 1
+ # Nested conflicts in Git ReReRe
+ - include: conflicts
+ - include: invalid-conflict-marker
+
+ invalid-conflict-marker:
+ - match: '{{bol}}(?:{{conflict_any}})'
+ scope: invalid.illegal.conflict.diff
+
+###[ SIDE-BY-SIDE ]############################################################
+
+ # https://www.gnu.org/software/diffutils/manual/diffutils.html#Side-by-Side
+ side-by-side:
+ - match: '{{bol}}(.*) (<)$'
captures:
- 1: punctuation.definition.deleted.diff
+ 1: markup.deleted.diff
2: punctuation.definition.deleted.diff
- 3: meta.whitespace.trailing.diff
- - match: ^Index(:) (.+)$\n?
- scope: meta.diff.index meta.index.diff
+ - match: '{{bol}}(.*) (\()$'
captures:
- 1: punctuation.separator.key-value.diff
- 2: meta.toc-list.file-name.diff
+ 1: comment.line.diff
+ 2: punctuation.definition.deleted.diff
+ - match: '{{bol}}(.*) ([\\|/]) (.*)$'
+ captures:
+ 1: markup.changed.diff
+ 2: punctuation.definition.changed.diff
+ 3: markup.changed.diff
+ - match: '{{bol}} {4,}(>)(?: (.*))?$'
+ captures:
+ 1: punctuation.definition.inserted.diff
+ 2: markup.inserted.diff
+ - match: '{{bol}} {4,}(\))(?: (.*))?$'
+ captures:
+ 1: punctuation.definition.inserted.diff
+ 2: comment.line.diff
+
+###############################################################################
+
+variables:
+ conflict_begin: <{5,}
+ conflict_end: '>{5,}'
+ conflict_split: ={5,}
+ conflict_base: \|{5,}
+ conflict_any: |-
+ (?x:
+ {{conflict_begin}}
+ | {{conflict_end}}
+ | {{conflict_split}}
+ | {{conflict_base}}
+ )
+
+ conflict_identifier: (?:\S.*?)
diff --git a/Diff/Symbol List - Conflicts.tmPreferences b/Diff/Symbol List - Conflicts.tmPreferences
new file mode 100644
index 0000000000..69593880da
--- /dev/null
+++ b/Diff/Symbol List - Conflicts.tmPreferences
@@ -0,0 +1,18 @@
+
+
+
+ scope
+ meta.block.conflict.begin.diff entity.name.section
+ settings
+
+ showInSymbolList
+ 1
+ symbolTransformation
+ s/^/Conflict: /
+ showInIndexedSymbolList
+ 0
+ showInIndexedReferenceList
+ 0
+
+
+
diff --git a/Diff/syntax_test_diff.diff b/Diff/syntax_test_diff.diff
deleted file mode 100644
index e2e0550f6f..0000000000
--- a/Diff/syntax_test_diff.diff
+++ /dev/null
@@ -1,101 +0,0 @@
-# SYNTAX TEST "Packages/Diff/Diff.sublime-syntax"
-
---- Path to Original File
-#^^^^^^^^^^^^^^^^^^^^^^^^ meta.diff.header.from-file meta.header.from-file.diff
-# <- punctuation.definition.from-file.diff
-#^^ punctuation.definition.from-file.diff
-
-+++ Path to Modified File
-#^^^^^^^^^^^^^^^^^^^^^^^^ meta.diff.header.to-file meta.header.to-file.diff
-# <- punctuation.definition.to-file.diff
-#^^ punctuation.definition.to-file.diff
-
-28a211
-#^^^^^ meta.diff.range.normal meta.range.normal.diff
-
-@@ -2,8 +2,11 @@
-#^^^^^^^^^^^^^^^ meta.diff.range.unified meta.range.unified.diff
-# <- punctuation.definition.range.diff
-#^ punctuation.definition.range.diff
-# ^ - punctuation
-# ^^^^^^^^^^ meta.toc-list.line-number.diff
-# ^ - punctuation
-# ^^ punctuation.definition.range.diff
-# ^ - entity - punctuation
-
-@@ -2,8 +2,11 @@ function_hint(int var)
-#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.diff.range.unified meta.range.unified.diff
-# <- punctuation.definition.range.diff
-#^ punctuation.definition.range.diff
-# ^ - punctuation
-# ^^^^^^^^^^ meta.toc-list.line-number.diff
-# ^ - punctuation
-# ^^ punctuation.definition.range.diff
-# ^ - entity - punctuation
-# ^^^^^^^^^^^^^^^^^^^^^^ entity.name.section.diff
-# ^ - entity.name.section.diff
-
---- Range ----
-#^^^^^^^^^^^^^ meta.diff.range.context meta.range.context.diff
-# <- punctuation.definition.range.diff
-#^^ punctuation.definition.range.diff
-# ^^^^ punctuation.definition.range.diff
-
-*** Range ****
-#^^^^^^^^^^^^^ meta.diff.range.context meta.range.context.diff
-# <- punctuation.definition.range.diff
-#^^ punctuation.definition.range.diff
-# ^^^^ punctuation.definition.range.diff
-
-***************
-#^^^^^^^^^^^^^^ meta.separator.diff punctuation.definition.separator.diff
-
-****************
-#^^^^^^^^^^^^^^^ -meta.separator.diff punctuation.definition.separator.diff
-
-===================================================================
-#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.separator.diff punctuation.definition.separator.diff
-
-====================================================================
-#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -meta.separator.diff punctuation.definition.separator.diff
-
----
-#^^ meta.separator.diff
-#^^ punctuation.definition.separator.diff
-
-----
-#^^^ -meta.separator.diff
-#^^^ -punctuation.definition.separator.diff
-
-Plain Text
-#^^^^^^^^^ source.diff
-
-+ Addition
-# <- markup.inserted.diff punctuation.definition.inserted.diff
-# ^^^^^^^^ markup.inserted.diff - meta.whitespace
-# ^^ markup.inserted.diff meta.whitespace.trailing.diff
-
-> Addition
-# <- markup.inserted.diff punctuation.definition.inserted.diff
-# ^^^^^^^^ markup.inserted.diff - meta.whitespace
-# ^^ markup.inserted.diff meta.whitespace.trailing.diff
-
-- Deletion
-# <- markup.deleted.diff punctuation.definition.deleted.diff
-# ^^^^^^^^ markup.deleted.diff - meta.whitespace
-# ^^ markup.deleted.diff meta.whitespace.trailing.diff
-
-< Deletion
-# <- markup.deleted.diff punctuation.definition.deleted.diff
-# ^^^^^^^^ markup.deleted.diff - meta.whitespace
-# ^^ markup.deleted.diff meta.whitespace.trailing.diff
-
-! Modified
-# <- markup.changed.diff punctuation.definition.changed.diff
-# ^^^^^^^^ markup.changed.diff - meta.whitespace
-# ^^ markup.changed.diff meta.whitespace.trailing.diff
-
-Index: value
-#^^^^^^^^^^^ meta.diff.index meta.index.diff
-# ^ punctuation.separator.key-value.diff
-# ^^^^^ meta.toc-list.file-name.diff
diff --git a/Diff/tests/syntax_test_diff.diff b/Diff/tests/syntax_test_diff.diff
new file mode 100644
index 0000000000..6e1c1299ca
--- /dev/null
+++ b/Diff/tests/syntax_test_diff.diff
@@ -0,0 +1,614 @@
+\ SYNTAX TEST partial-symbols "Packages/Diff/Diff.sublime-syntax"
+
+--- Path to Original File
+\^^^^^^^^^^^^^^^^^^^^^^^^ meta.diff.header.from-file meta.header.from-file.diff - source.diff.git
+\ <- punctuation.definition.from-file.diff
+\^^ punctuation.definition.from-file.diff
+
++++ Path to Modified File
+\^^^^^^^^^^^^^^^^^^^^^^^^ meta.diff.header.to-file meta.header.to-file.diff
+\ <- punctuation.definition.to-file.diff
+\^^ punctuation.definition.to-file.diff
+
+28a211
+\^^^^^ meta.diff.range.normal meta.range.normal.diff
+
+@@ -2,8 +2,11 @@
+\^^^^^^^^^^^^^^^ meta.diff.range.unified meta.range.unified.diff
+\ <- punctuation.definition.range.begin.diff
+\^ punctuation.definition.range.begin.diff
+\ ^ - punctuation
+\ ^^^^^^^^^^ meta.toc-list.hunk.diff
+\ ^ - punctuation
+\ ^^ punctuation.definition.range.end.diff
+\ ^ - entity - punctuation
+
+@@ -2,8 +2,11 @@ function_hint(int var)
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.toc-list.hunk.diff
+\^^^^^^^^^^^^^^^ meta.diff.range.unified meta.range.unified.diff
+\ <- punctuation.definition.range.begin.diff
+\^ punctuation.definition.range.begin.diff
+\ ^ - punctuation
+\ ^ - punctuation
+\ ^^ punctuation.definition.range.end.diff
+\ ^ - entity - punctuation
+\ ^^^^^^^^^^^^^^^^^^^^^^ entity.name.section.diff
+\ ^ - entity.name.section.diff
+
+==== From-File - To-File ====
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.header
+\^^^^^^^^^^^^^ meta.header.from-file.diff
+\^^^ punctuation.definition.from-file.diff
+\ ^^^^^^^^^^^^ meta.header.to-file.diff
+\ ^ punctuation
+\ ^^^^ punctuation.definition.to-file.diff
+
+--- Range ----
+\^^^^^^^^^^^^^ meta.diff.range.context meta.range.context.diff
+\ <- punctuation.definition.range.begin.diff
+\^^ punctuation.definition.range.begin.diff
+\ ^^^^ punctuation.definition.range.end.diff
+
+*** Range ****
+\^^^^^^^^^^^^^ meta.diff.range.context meta.range.context.diff
+\ <- punctuation.definition.range.begin.diff
+\^^ punctuation.definition.range.begin.diff
+\ ^^^^ punctuation.definition.range.end.diff
+
+***************
+\^^^^^^^^^^^^^^ meta.separator.diff punctuation.separator.block.diff
+
+****************
+\^^^^^^^^^^^^^^^ - meta - punctuation
+
+===================================================================
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.separator.diff punctuation.separator.block.diff
+
+====================================================================
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta - punctuation
+
+---
+\^^ meta.separator.diff
+\^^ punctuation.separator.block.diff
+
+----
+\^^^ - meta - punctuation
+
+Plain Text
+\^^^^^^^^^ source.diff - markup
+
++ Addition
+\ <- punctuation.definition.inserted.diff
+\ ^^^^^^^^ markup.inserted.diff - meta.whitespace
+\ ^^ markup.inserted.diff meta.whitespace.trailing.diff
+
+> Addition
+\ <- punctuation.definition.inserted.diff
+\ ^^^^^^^^ markup.inserted.diff - meta.whitespace
+\ ^^ markup.inserted.diff meta.whitespace.trailing.diff
+
+- Deletion
+\ <- punctuation.definition.deleted.diff
+\ ^^^^^^^^ markup.deleted.diff - meta.whitespace
+\ ^^ markup.deleted.diff meta.whitespace.trailing.diff
+
+< Deletion
+\ <- punctuation.definition.deleted.diff
+\ ^^^^^^^^ markup.deleted.diff - meta.whitespace
+\ ^^ markup.deleted.diff meta.whitespace.trailing.diff
+
+! Modified
+\ <- punctuation.definition.changed.diff
+\ ^^^^^^^^ markup.changed.diff - meta.whitespace
+\ ^^ markup.changed.diff meta.whitespace.trailing.diff
+
+Index: lao
+\ @@@ local-definition
+\^^^^^^^^^^ meta.diff.index meta.index.diff
+\^^^^ meta.mapping.key.diff keyword.other.diff
+\ ^ punctuation.separator.key-value.diff
+\ ^^^ meta.mapping.value.diff meta.toc-list.file-name.diff
+
+\ No newline at end of file
+\^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line
+\ <- punctuation.definition.comment
+
+
+Normal Format https://www.gnu.org/software/diffutils/manual/diffutils.html#Example-Normal
+1,2d0
+\ <- meta.diff.range.normal meta.range.normal.diff
+\^^^^ meta.diff.range.normal meta.range.normal.diff
+\^ punctuation.separator.range.diff
+\ ^ support.function.diff
+< The Way that can be told of is not the eternal Way;
+< The name that can be named is not the eternal name.
+4c2,3
+\ <- meta.diff.range.normal meta.range.normal.diff
+\^^^^ meta.diff.range.normal meta.range.normal.diff
+\^ support.function.diff
+\ ^ punctuation.separator.range.diff
+< The Named is the mother of all things.
+\ <- markup.deleted.diff punctuation.definition.deleted.diff
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.deleted.diff
+\^ punctuation.definition.deleted.diff
+---
+\ <- meta.separator.diff punctuation.separator.block.diff
+\^^ meta.separator.diff punctuation.separator.block.diff
+> The named is the mother of all things.
+>
+\^ - meta.whitespace
+11a11,13
+\ <- meta.diff.range.normal meta.range.normal.diff
+\^^^^^^^ meta.diff.range.normal meta.range.normal.diff
+\ ^ support.function.diff
+\ ^ punctuation.separator.range.diff
+> They both may be called deep and profound.
+> Deeper and more profound,
+> The door of all subtleties!
+\ <- markup.inserted.diff punctuation.definition.inserted.diff
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.inserted.diff
+\^ punctuation.definition.inserted.diff
+
+
+Context Format https://www.gnu.org/software/diffutils/manual/diffutils.html#Example-Context
+*** lao 2002-02-21 23:30:39.942229878 -0800
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.header.from-file
+\^^ punctuation.definition.from-file
+\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.number
+
+\ Only consider `---` to be a "to" if it follows a `***`
+*** lao 2002-02-21 23:30:39.942229878 -0800
+--- tzu 2002-02-21 23:30:50.442260588 -0800
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.header.to-file
+\^^ punctuation.definition.to-file
+\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.number
+***************
+\^^^^^^^^^^^^^^ meta.separator.diff punctuation.separator.block.diff
+*** 1,7 ****
+\^^^^^^^^^^^ meta.diff.range.context meta.range.context.diff
+\ ^ punctuation.separator
+\^^ punctuation.definition.range.begin.diff
+\ ^^^^ punctuation.definition.range.end.diff
+- The Way that can be told of is not the eternal Way;
+\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.deleted.diff
+\ <- punctuation.definition.deleted.diff
+- The name that can be named is not the eternal name.
+\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.deleted.diff
+\ <- punctuation.definition.deleted.diff
+ The Nameless is the origin of Heaven and Earth;
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - markup
+! The Named is the mother of all things.
+\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.changed.diff
+\ <- punctuation.definition.changed.diff
+ Therefore let there always be non-being,
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - markup
+ so we may see their subtlety,
+ And let there always be being,
+--- 1,6 ----
+\^^^^^^^^^^^ meta.diff.range.context meta.range.context.diff
+\^^ punctuation.definition.range.begin.diff
+\ ^ punctuation.separator
+\ ^^^^ punctuation.definition.range.end.diff
+ The Nameless is the origin of Heaven and Earth;
+! The named is the mother of all things.
+\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.changed.diff
+\ <- punctuation.definition.changed.diff
+!
+\ <- markup.changed.diff punctuation.definition.changed.diff
+\^ - meta.whitespace
+ Therefore let there always be non-being,
+ so we may see their subtlety,
+ And let there always be being,
+***************
+\^^^^^^^^^^^^^^ meta.separator.diff punctuation.separator.block.diff
+*** 9,11 ****
+\^^^^^^^^^^^^ meta.diff.range.context meta.range.context.diff
+\ ^ punctuation.separator
+\^^ punctuation.definition.range.begin.diff
+\ ^^^^ punctuation.definition.range.end.diff
+--- 8,13 ----
+\^^^^^^^^^^^^ meta.diff.range.context meta.range.context.diff
+\ ^ punctuation.separator
+\^^ punctuation.definition.range.begin.diff
+\ ^^^^ punctuation.definition.range.end.diff
+ The two are the same,
+ But after they are produced,
+ they have different names.
++ They both may be called deep and profound.
++ Deeper and more profound,
++ The door of all subtleties!
+
+
+Unified Format https://www.gnu.org/software/diffutils/manual/diffutils.html#Example-Unified
+--- lao 2002-02-21 23:30:39.942229878 -0800
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.header.from-file
+\^^ punctuation.definition.from-file
+\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.number
++++ tzu 2002-02-21 23:30:50.442260588 -0800
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.header.to-file
+\^^ punctuation.definition.to-file
+\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.number
+@@ -1,7 +1,6 @@
+\^^^^^^^^^^^^^^ meta.diff.range.unified meta.range.unified.diff
+\^ punctuation.definition.range.begin.diff
+\ ^^ punctuation.definition.range.end.diff
+-The Way that can be told of is not the eternal Way;
+-The name that can be named is not the eternal name.
+ The Nameless is the origin of Heaven and Earth;
+-The Named is the mother of all things.
++The named is the mother of all things.
++
+ Therefore let there always be non-being,
+ so we may see their subtlety,
+ And let there always be being,
+@@ -9,3 +8,6 @@
+ The two are the same,
+ But after they are produced,
+ they have different names.
++They both may be called deep and profound.
++Deeper and more profound,
++The door of all subtleties!
+
+
+Diff3 Normal Format https://www.gnu.org/software/diffutils/manual/diffutils.html#Example-diff3-Normal
+====2
+\ <- meta.hunk.diff punctuation.section.hunk.diff
+\^^^^^ meta.hunk.diff punctuation.section.hunk.diff
+\ ^ constant.numeric.from-file.diff
+1:1,2c
+\ <- meta.hunk.diff meta.diff.range.normal meta.range.normal.diff meta.toc-list.hunk.diff constant.numeric.from-file.diff
+\^^^^^ meta.hunk.diff meta.diff.range.normal meta.range.normal.diff meta.toc-list.hunk.diff
+\^ punctuation.separator.file.diff
+\ ^ punctuation.separator.range.diff
+\ ^ support.function.diff
+\ ^ - meta.toc-list
+3:1,2c
+ The Way that can be told of is not the eternal Way;
+ The name that can be named is not the eternal name.
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.hunk.diff meta.block.diff markup.changed.diff
+2:0a
+\ <- meta.hunk.diff meta.diff.range.normal meta.range.normal.diff meta.toc-list.hunk.diff constant.numeric.from-file.diff
+\^^^ meta.hunk.diff meta.diff.range.normal meta.range.normal.diff meta.toc-list.hunk.diff
+\^ punctuation.separator.file.diff
+\ ^ support.function.diff
+\ ^ - meta.toc-list
+====1
+\ <- meta.hunk.diff punctuation.section.hunk.diff
+\^^^^^ meta.hunk.diff punctuation.section.hunk.diff
+\ ^ constant.numeric.from-file.diff
+1:4c
+ The Named is the mother of all things.
+2:2,3c
+3:4,5c
+ The named is the mother of all things.
+
+====3
+\ <- meta.hunk.diff punctuation.section.hunk.diff
+\^^^^^ meta.hunk.diff punctuation.section.hunk.diff
+\ ^ constant.numeric.from-file.diff
+1:8c
+\ <- meta.hunk.diff meta.diff.range.normal meta.range.normal.diff meta.toc-list.hunk.diff constant.numeric.from-file.diff
+\^^^ meta.hunk.diff meta.diff.range.normal meta.range.normal.diff meta.toc-list.hunk.diff
+\^ punctuation.separator.file.diff
+\ ^ support.function.diff
+\ ^ - meta.toc-list
+2:7c
+ so we may see their outcome.
+3:9c
+ so we may see their result.
+====
+\ <- meta.hunk.diff punctuation.section.hunk.diff
+\^^^^ meta.hunk.diff punctuation.section.hunk.diff
+1:11a
+2:11,13c
+ They both may be called deep and profound.
+ Deeper and more profound,
+ The door of all subtleties!
+3:13,14c
+
+ -- The Way of Lao-Tzu, tr. Wing-tsit Chan
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.hunk.diff meta.block.diff markup.changed.diff
+
+
+Diff3 Edit Format https://www.gnu.org/software/diffutils/manual/diffutils.html#Selecting-Which-Changes-to-Incorporate
+11a
+\ <- meta.hunk.diff meta.diff.range.normal meta.range.normal.diff
+\^^^ meta.hunk.diff
+\^ meta.diff.range.normal meta.range.normal.diff
+\ ^ support.function.diff
+ -- The Way of Lao-Tzu, tr. Wing-tsit Chan
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.hunk.diff meta.block.diff markup.inserted.diff
+.
+\ <- meta.hunk.diff punctuation.terminator.hunk.diff
+8c
+\ <- meta.hunk.diff meta.diff.range.normal meta.range.normal.diff
+\^^ meta.hunk.diff
+\^ support.function.diff
+ so we may see their result.
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.hunk.diff meta.block.diff markup.changed.diff
+.
+\ <- meta.hunk.diff punctuation.terminator.hunk.diff
+24d
+\ <- meta.diff.range.normal meta.range.normal.diff
+\^ meta.diff.range.normal meta.range.normal.diff
+\ ^ support.function.diff
+
+ This is removed content
+\^^^^^^^^^^^^^^^^^^^^^^^^^ meta.hunk.diff meta.block.diff markup.deleted.diff
+.
+\ <- meta.hunk.diff punctuation.terminator.hunk.diff
+
+
+SVN sample https://svnbook.red-bean.com/en/1.7/svn-book.html#idm10685
+Index: deleted-file
+\ @@@@@@@@@@@@ local-definition
+\^^^^^^^^^^^^^^^^^^ meta.mapping.diff meta.diff.index meta.index.diff
+\^^^^ meta.mapping.key.diff keyword.other.diff
+\ ^ punctuation.separator.key-value.diff
+\ ^^^^^^^^^^^^ meta.mapping.value.diff meta.toc-list.file-name.diff
+===================================================================
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.separator.diff punctuation.separator.block.diff
+--- deleted-file (revision 3)
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.diff.header.from-file meta.header.from-file.diff
+\^^ punctuation.definition.from-file.diff
+\ ^^^^^^^^^^^^ comment.block.diff
++++ deleted-file (working copy)
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.diff.header.to-file meta.header.to-file.diff
+\^^ punctuation.definition.to-file.diff
+\ ^^^^^^^^^^^^^^ comment.block.diff
+@@ -1 +0,0 @@
+\^^^^^^^^^^^^ meta.diff.range.unified meta.range.unified.diff meta.toc-list.hunk.diff
+\^ punctuation.definition.range.begin.diff
+\ ^ support.function.diff
+\ ^ support.function.diff
+\ ^ punctuation.separator.sequence.diff
+\ ^^ punctuation.definition.range.end.diff
+-This file will be deleted.
+\^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.deleted.diff
+Index: changed-file
+\ @@@@@@@@@@@@ local-definition
+\^^^^^^^^^^^^^^^^^^ meta.mapping.diff meta.diff.index meta.index.diff
+\^^^^ meta.mapping.key.diff keyword.other.diff
+\ ^ punctuation.separator.key-value.diff
+\ ^^^^^^^^^^^^ meta.mapping.value.diff meta.toc-list.file-name.diff
+===================================================================
+--- changed-file (revision 4)
++++ changed-file (working copy)
+@@ -1,6 +1,6 @@
+ The letters in a line of text
+ Could make your day much better.
+ But expanded into paragraphs,
+-I'd tell of kangaroos and calves
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.deleted.diff
++I'd tell of monkeys and giraffes
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.inserted.diff
+ Until you were all smiles and laughs
+ From my letter made of letters.
+
+Property changes on: changed-file
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.mapping.diff meta.diff.index meta.index.diff
+\^^^^^^^^^^^^^^^^^^ meta.mapping.key.diff keyword.other.diff
+\ ^ punctuation.separator.key-value.diff
+\ ^^^^^^^^^^^^ meta.mapping.value.diff meta.toc-list.file-name.diff
+___________________________________________________________________
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.separator.diff punctuation.separator.block.diff
+Added: propname
+\ @@@@@@@@ local-definition
+\^^^^^^^^^^^^^^ meta.mapping.diff meta.diff.index meta.index.diff
+\^^^^ meta.mapping.key.diff keyword.other.diff
+\ ^ punctuation.separator.key-value.diff
+\ ^^^^^^^^ meta.mapping.value.diff meta.toc-list.file-name.diff
+## -0,0 +1 ##
++propvalue
+\^^^^^^^^^ markup.inserted.diff
+Index: added-file
+\ @@@@@@@@@@ local-definition
+===================================================================
+--- added-file (revision 0)
++++ added-file (working copy)
+@@ -0,0 +1 @@
++This is an added file.
+
+
+https://www.gnu.org/software/diffutils/manual/diffutils.html#Marking-Conflicts-1
+<<<<<<< A
+\ @ local-definition "Conflict: A"
+\^^^^^^^^^ meta.block.conflict.begin.diff - meta.block meta.block - markup
+\^^^^^^ punctuation.section.block.begin.diff
+\ ^ - entity - punctuation
+\ ^ entity.name.section.diff
+\ ^ - entity
+lines from A
+\^^^^^^^^^^^^ meta.block.conflict.diff markup.deleted.diff - meta.block meta.block
+=======
+\^^^^^^^ meta.block.conflict.separator.diff - meta.block meta.block - markup
+\^^^^^^ punctuation.section.block.diff
+lines from B
+\^^^^^^^^^^^ meta.block.conflict.diff markup.inserted.diff
+>>>>>>> B
+\^^^^^^^^^ meta.block.conflict.end.diff - meta.block meta.block - markup
+\^^^^^^ punctuation.section.block.end.diff
+\ ^ - entity
+\ ^ entity.name.section.diff
+\ ^ - entity
+context context
+\^^^^^^^^^^^^^^^ - meta.block
+
+<<<<<<< A
+\ @ local-definition "Conflict: A"
+lines from A
+||||||| B
+\^^^^^^^^^ meta.block.conflict.separator.diff - meta.block meta.block - markup
+\^^^^^^ punctuation.section.block.diff
+\ ^ - entity - punctuation
+\ ^ entity.name.section.diff
+\ ^ - entity
+lines from B
+\^^^^^^^^^^^^ meta.block.conflict.diff comment.block.diff - meta.block meta.block - markup
+=======
+\^^^^^^ meta.block.conflict.separator.diff punctuation.section.block.diff - meta.block meta.block - markup
+>
+\ <- meta.block.conflict.diff markup.inserted.diff - punctuation - invalid
+<
+\ <- meta.block.conflict.diff markup.inserted.diff - punctuation - invalid
+|||||
+\^^^^ meta.block.conflict.diff markup.inserted.diff invalid.illegal.conflict.diff
+lines from C
+\^^^^^^^^^^^^ meta.block.conflict.diff markup.inserted.diff
+>>>>>>> C
+context context
+\ <- - meta.block
+
+<<<<<<< tzu
+\ @@@ local-definition "Conflict: tzu"
+=======
+The Way that can be told of is not the eternal Way;
+The name that can be named is not the eternal name.
+>>>>>>> tao
+
+<<<<<<< lao
+\ @@@ local-definition "Conflict: lao"
+||||||| tzu
+They both may be called deep and profound.
+Deeper and more profound,
+The door of all subtleties!
+=======
+
+ -- The Way of Lao-Tzu, tr. Wing-tsit Chan
+>>>>>>> tao
+
+<<<<<<< lao
+\ @@@ local-definition "Conflict: lao"
+=======
+
+ -- The Way of Lao-Tzu, tr. Wing-tsit Chan
+>>>>>>> tao
+
+
+https://www.gnu.org/software/diffutils/manual/diffutils.html#Generating-the-Merged-Output-Directly
+<<<<<<< tzu
+\ @@@ local-definition "Conflict: tzu"
+=======
+The Way that can be told of is not the eternal Way;
+The name that can be named is not the eternal name.
+>>>>>>> tao
+The Nameless is the origin of Heaven and Earth;
+The Named is the mother of all things.
+Therefore let there always be non-being,
+ so we may see their subtlety,
+And let there always be being,
+ so we may see their result.
+The two are the same,
+But after they are produced,
+ they have different names.
+<<<<<<< lao
+\ @@@ local-definition "Conflict: lao"
+||||||| tzu
+They both may be called deep and profound.
+Deeper and more profound,
+The door of all subtleties!
+=======
+
+ -- The Way of Lao-Tzu, tr. Wing-tsit Chan
+>>>>>>> tao
+
+If you have questions, please
+<<<<<<< HEAD
+\ @@@@ local-definition "Conflict: HEAD"
+open an issue
+=======
+ask your question in IRC.
+>>>>>>> branch-a
+
+
+\ https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging
+#! /usr/bin/env ruby
+
+def hello
+<<<<<<< ours
+\ @@@@ local-definition "Conflict: ours"
+ puts 'hola world'
+||||||| base
+ puts 'hello world'
+=======
+ puts 'hello mundo'
+>>>>>>> theirs
+end
+
+hello()
+
+
+\ https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging#_basic_merge_conflicts
+<<<<<<< HEAD:index.html
+\ @@@@@@@@@@@@@@@ local-definition "Conflict: HEAD:index.html"
+
+=======
+
+>>>>>>> iss53:index.html
+
+
+\ https://git-scm.com/docs/rerere.html#_nested_conflicts
+<<<<<<< HEAD
+\ @@@@ local-definition "Conflict: HEAD"
+\^^^^^^^^^^^^ meta.block.conflict.begin.diff
+\^^^^^^ punctuation.section.block.begin.diff
+\ ^^^^ entity.name.section.diff
+111
+\^^ meta.block.conflict.diff markup.deleted.diff
+=======
+\^^^^^^^ meta.block.conflict.separator.diff
+\^^^^^^ punctuation.section.block.diff
+<<<<<<< HEAD
+\ @@@@ local-definition "Conflict: HEAD"
+\^^^^^^^^^^^^ meta.block.conflict.diff markup.inserted.diff meta.block.conflict.begin.diff
+\^^^^^^ punctuation.section.block.begin.diff
+\ ^^^^ entity.name.section.diff
+333
+\^^ meta.block.conflict.diff markup.inserted.diff meta.block.conflict.diff markup.deleted.diff
+=======
+\^^^^^^ meta.block.conflict.diff markup.inserted.diff meta.block.conflict.separator.diff punctuation.section.block.diff
+222
+\^^ meta.block.conflict.diff markup.inserted.diff meta.block.conflict markup.inserted.diff
+>>>>>>> branch-2
+\^^^^^^^^^^^^^^^ meta.block.conflict.diff markup.inserted.diff meta.block.conflict.end.diff
+\^^^^^^ punctuation.section.block.end.diff
+\ ^^^^^^^^ entity.name.section.diff
+>>>>>>> branch-3~
+\^^^^^^^^^^^^^^^^ meta.block.conflict.end.diff
+\^^^^^^ punctuation.section.block.end.diff
+\ ^^^^^^^^^ entity.name.section.diff
+
+
+\ https://www.gnu.org/software/diffutils/manual/diffutils.html#Example-Side-by-Side
+The Way that can be told of is n <
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.deleted.diff
+\ ^ punctuation.definition.deleted.diff
+The name that can be named is no <
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.deleted.diff
+\ ^ punctuation.definition.deleted.diff
+The Nameless is the origin of He The Nameless is the origin of He
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - markup
+The Named is the mother of all t | The named is the mother of all t
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.changed.diff
+\ ^ punctuation.definition.changed.diff
+\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.changed.diff
+ >
+\ ^ punctuation.definition.inserted.diff
+Therefore let there always be no Therefore let there always be no
+ so we may see their subtlety, so we may see their subtlety,
+And let there always be being, And let there always be being,
+ so we may see their outcome. so we may see their outcome.
+The two are the same, The two are the same,
+But after they are produced, But after they are produced,
+ they have different names. they have different names.
+ > They both may be called deep and
+\ ^ punctuation.definition.inserted.diff
+\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.inserted.diff
+ > Deeper and more profound,
+\ ^ punctuation.definition.inserted.diff
+\ ^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.inserted.diff
+ > The door of all subtleties!
+\ ^ punctuation.definition.inserted.diff
+\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.inserted.diff
diff --git a/Diff/tests/syntax_test_switch_to_git.diff b/Diff/tests/syntax_test_switch_to_git.diff
new file mode 100644
index 0000000000..34296d957d
--- /dev/null
+++ b/Diff/tests/syntax_test_switch_to_git.diff
@@ -0,0 +1,15 @@
+\ SYNTAX TEST "Packages/Git Formats/Git Diff.sublime-syntax"
+From 8f72bad1baf19a53459661343e21d6491c3908d3 Mon Sep 17 00:00:00 2001
+\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.diff - source source
+\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.other.hash.git
+From: Tony Luck
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.git-header.diff meta.mapping.diff - source source
+\^^^ keyword.other.diff
+\ ^ punctuation.separator.mapping.key-value.diff
+\ ^^^^^^^^^ meta.reference.user.git
+\ ^^^^^^^^^^^^^^^^^^^^^ meta.reference.email.git
+\ ^ punctuation.definition.reference.email.begin.git
+\ ^^^^^^^^^^^^^^^^^^^ entity.name.reference.email.git
+\ ^ punctuation.separator.email.git
+\ ^ punctuation.separator.domain.git
+\ ^ punctuation.definition.reference.email.end.git
diff --git a/Git Formats/Git Diff.sublime-syntax b/Git Formats/Git Diff.sublime-syntax
new file mode 100644
index 0000000000..e9cf8b0ba4
--- /dev/null
+++ b/Git Formats/Git Diff.sublime-syntax
@@ -0,0 +1,579 @@
+%YAML 1.2
+---
+# https://www.sublimetext.com/docs/syntax.html
+# https://git-scm.com/docs/git-format-patch
+# https://git-scm.com/docs/diff-format
+name: Git Diff
+scope: source.diff.git
+version: 2
+
+extends: Packages/Diff/Diff (Basic).sublime-syntax
+
+file_extensions:
+ - diff.eml
+ - patch.eml
+ - diff.mbox
+ - patch.mbox
+
+first_line_match: |-
+ ^(?x:
+ diff[ ]--(?:git|combined|cc)[ ]
+ | From [ ] \w+@z [ ]
+ Thu [ ] Jan [ ]{2} 1 [ ] 00:00:00 [ ] 1970 # git-send-email
+ | From [ ] (?:[0-9a-fA-F]{40}|[0-9a-fA-F]{64}) [ ]
+ Mon [ ] Sep [ ] 17 [ ] 00:00:00 [ ] 2001 # git-format-patch
+ )
+
+contexts:
+ main:
+ - match: (?={{git_first_line}})
+ push: email-first-line
+
+ # If you can't find the magic first line, just highlight diffs.
+ - include: diffs
+
+###[ EMAIL ]###################################################################
+
+ # https://git-scm.com/docs/git-format-patch#_description
+ email-first-line:
+ - meta_content_scope: comment.line.diff
+ - match: '{{git_hash_full}}'
+ scope: constant.other.hash.git
+ - match: \n|$
+ set: email-headers
+
+ email-headers:
+ - meta_scope: meta.block.git-header.diff
+
+ # Go to email body
+ - match: '{{empty_line}}'
+ set: email-body
+
+ - include: email-header-person
+ - include: email-header-commit
+ - include: email-header-subject-line
+ - include: email-header-date
+ - include: email-header-generic
+
+ email-header-person:
+ - match: |-
+ {{bol}}(?x:
+ ( From | To | Author | Committer
+ | Co-authored-by
+ | Signed-off-by
+ | Reviewed-by
+ | Acked-by
+ | Helped-by
+ )
+ (:)
+ )
+ captures:
+ 1: keyword.other.diff
+ 2: punctuation.separator.mapping.key-value.diff
+ push: email-header-person-body
+
+ email-header-person-body:
+ - meta_scope: meta.mapping.diff
+ - include: scope:text.git.mailmap
+ # The mailmap include has bad interactions with
+ # pop-before-next-email-header
+ - include: pop-before-eol
+
+ email-header-commit:
+ - match: '{{bol}}(In-Reply-To|References)(:)'
+ captures:
+ 1: keyword.other.diff
+ 2: punctuation.separator.mapping.key-value.diff
+ push: email-header-commit-body
+
+ email-header-commit-body:
+ - meta_scope: meta.mapping.diff
+ - match: '{{git_hash}}'
+ scope: constant.other.hash.git
+ - include: pop-before-next-email-header
+
+ email-header-subject-line:
+ - match: '{{bol}}(Subject)(:)'
+ captures:
+ 1: keyword.other.diff
+ 2: punctuation.separator.mapping.key-value.diff
+ push: email-header-subject-line-body
+
+ email-header-subject-line-body:
+ - meta_scope: meta.mapping.diff
+ - meta_content_scope: markup.heading.diff
+ - include: patch-annotation
+ - include: pop-before-next-email-header
+
+ patch-annotation:
+ - match: (\[)(?:(RFC) )?PATCH
+ captures:
+ 1: punctuation.definition.annotation.begin.diff
+ 2: storage.modifier.diff
+ push: patch-annotation-content
+
+ patch-annotation-content:
+ - meta_scope: variable.annotation.diff
+ - match: \]
+ scope: punctuation.definition.annotation.end.diff
+ pop: 1
+ - match: \bv[0-9]+\b
+ scope: meta.annotation.patch-version.diff storage.modifier.diff
+ - match: ([0-9]+)(/)([0-9]+)
+ scope: meta.annotation.patch-sequence.diff
+ captures:
+ 1: meta.number.integer.decimal.diff constant.numeric.value.diff
+ 2: punctuation.separator.sequence.diff
+ 3: meta.number.integer.decimal.diff constant.numeric.value.diff
+
+ email-header-date:
+ - match: '{{bol}}((?:Author|Committer)?Date)(:)'
+ captures:
+ 1: keyword.other.diff
+ 2: punctuation.separator.mapping.key-value.diff
+ push: email-header-date-body
+
+ email-header-date-body:
+ - meta_scope: meta.mapping.diff
+ - match: |-
+ (?x)
+ {{day3}}(,) [ ] # Day of week
+ [0-3]?[0-9] [ ] # Day of month
+ {{month3}} [ ] # Month
+ [0-9]{4} [ ] # Year
+ [0-9]{2} (:) # Hour
+ [0-9]{2} (:) # Minute
+ [0-9]{2} # Second
+ (?:[ ]([+-][0-9]{4}))? # Optional UTC offset
+ scope: meta.date.diff constant.numeric.value.diff
+ captures:
+ 1: punctuation.separator.date.diff
+ 2: punctuation.separator.date.diff
+ 3: punctuation.separator.date.diff
+ 4: storage.modifier.diff
+ - include: pop-before-next-email-header
+
+ email-header-generic:
+ - match: '{{bol}}\b([\w-]+)\b(:)'
+ captures:
+ 1: keyword.other.diff
+ 2: punctuation.separator.mapping.key-value.diff
+ push: email-header-generic-body
+
+ email-header-generic-body:
+ - meta_scope: meta.mapping.diff
+ - include: pop-before-next-email-header
+
+ email-body:
+ - meta_content_scope: meta.block.git-body.diff
+ # https://git-scm.com/docs/git-mailinfo#Documentation/git-mailinfo.txt---scissors
+ - match: '{{bol}}(?=--[ -]*{{scissors}}(?:{{scissors}}|[ -])*--\s*$)'
+ set: [email-headers, scissors-line]
+ - match: '{{bol}}(---)\n'
+ captures:
+ 1: punctuation.section.block.diff
+ set: [diffs, stat]
+ - match: '{{bol}}{{next_diff_header}}'
+ set: diffs
+ - include: Git Commit Message.sublime-syntax#commit-message
+ - match: '{{bol}}>+'
+ scope: punctuation.definition.blockquote.git
+ push: email-quote-body
+
+ email-quote-body:
+ - meta_scope: markup.quote.git
+ - include: pop-eol
+ - include: Git Commit Message.sublime-syntax#commit-message
+
+ scissors-line:
+ - meta_scope: punctuation.section.block.git
+ - include: pop-eol
+ - match: '{{scissors}}'
+ scope: support.function.scissors.git
+
+###[ LEADING TEXT ]############################################################
+
+ stat:
+ - include: pop-before-diff-header
+ - match: '{{bol}} (?=([^|]+[ ]+)\|)'
+ push: stat-toc-line
+ - match: '{{bol}}(?= [0-9]+ file)'
+ push: stat-shortstat
+ - match: '{{bol}} (?=create mode)'
+ push: stat-create-file
+ - match: '{{bol}} (?=delete mode)'
+ push: stat-delete-file
+ - match: '{{empty_line}}'
+ set: diffs
+
+ stat-toc-line:
+ - include: pop-before-eol
+ - match: (?=\S.+\|)
+ push: stat-toc-filename
+ - match: |-
+ (?x:
+ (\|)[ ]+
+ (?:
+ (Bin)[ ]([0-9]+)[ ](->)[ ]([0-9]+)[ ](bytes) # Binary files
+ | ([0-9]+)[ ](\+*)(-*) # Text files
+ )
+ )
+ captures:
+ 1: punctuation.separator.sequence.diff
+ 2: storage.type.diff
+ 3: meta.number.integer.decimal.diff constant.numeric.value.diff markup.deleted.diff
+ 4: keyword.operator.logical.diff
+ 5: meta.number.integer.decimal.diff constant.numeric.value.diff markup.inserted.diff
+ 6: constant.numeric.suffix.diff
+ 7: meta.number.integer.decimal.diff constant.numeric.value.diff
+ 8: markup.inserted.diff
+ 9: markup.deleted.diff
+
+ stat-toc-filename:
+ - meta_content_scope: meta.toc-list.filename.diff meta.path.git string.unquoted.git
+ - match: (?=[ ]+\|)
+ pop: 1
+ - include: path-separators
+ - match: \.{3}
+ scope: keyword.operator.diff
+
+ stat-shortstat:
+ - include: pop-eol
+ - match: '[0-9]+'
+ scope: meta.number.integer.decimal.diff constant.numeric.value.diff
+ - match: ','
+ scope: punctuation.separator.sequence.diff
+ - match: insertions?(\()\+(\))
+ scope: markup.inserted.diff
+ captures:
+ 1: punctuation.definition.diff
+ 2: punctuation.definition.diff
+ - match: deletions?(\()-(\))
+ scope: markup.deleted.diff
+ captures:
+ 1: punctuation.definition.diff
+ 2: punctuation.definition.diff
+
+ stat-create-file:
+ - meta_content_scope: markup.inserted.diff
+ - include: pop-before-eol
+ - include: path-separators
+ - include: file-modes
+
+ stat-delete-file:
+ - meta_content_scope: markup.deleted.diff
+ - include: pop-before-eol
+ - include: path-separators
+ - include: file-modes
+
+###[ DIFF ]####################################################################
+
+ # https://git-scm.com/docs/diff-format#generate_patch_text_with_p
+ diffs:
+ - match: '{{bol}}(diff)( ((--)(?:git|combined|cc)))'
+ captures:
+ 1: meta.function-call.identifier.git variable.function.diff
+ 2: meta.function-call.arguments.git
+ 3: variable.parameter.diff
+ 4: punctuation.definition.parameter.diff
+ push: [diff-header, diff-file-header]
+
+ # https://git-scm.com/docs/git-format-patch#Documentation/git-format-patch.txt---no-signatureltsignaturegt
+ # This is the Git version unless otherwise configured. You will notice
+ # that once inside this context, you cannot leave. That seems to be how
+ # it works for these files.
+ - match: '{{bol}}(-- ){{eol}}'
+ scope: meta.separator.diff
+ captures:
+ 1: punctuation.section.block.diff
+ set: signature
+
+ signature:
+ - meta_content_scope: comment.block.diff
+
+ diff-header-unified-from-file:
+ - meta_prepend: true
+ - include: diff-file-header-path-start
+
+ diff-header-unified-to-file:
+ - meta_prepend: true
+ - include: diff-file-header-path-start
+
+ diff-file-header:
+ - meta_scope: meta.toc-list.git
+ - meta_content_scope: meta.function-call.arguments.git
+ - include: pop-eol
+ - include: diff-file-header-path-start
+
+ diff-file-header-path-start:
+ # TODO: Quoted file names https://git-scm.com/docs/git-config#Documentation/git-config.txt-corequotePath
+ - match: (?:a|b|ours|theirs)(?=/)
+ scope: variable.parameter.source.diff
+ push: diff-file-header-path
+
+ diff-file-header-path:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.path.diff string.unquoted.git
+ - match: (?=\s|$)
+ pop: 1
+ - match: \\.
+ scope: constant.character.escape.git
+ - include: path-separators
+
+ diff-header:
+ - meta_prepend: true
+ - meta_scope: meta.block.header.diff
+ # Detect & switch context to changed content
+ - match: '{{bol}}(?=@|GIT binary)'
+ set: diff-content
+
+ # old mode
+ # new mode
+ # deleted file mode
+ - match: '{{bol}}(?=deleted file mode)'
+ push:
+ - meta_content_scope: markup.deleted.diff
+ - include: pop-before-eol
+ - include: file-modes
+ - include: separator-comma
+
+ # new file mode
+ - match: '{{bol}}(?=new file mode)'
+ push:
+ - meta_content_scope: markup.inserted.diff
+ - include: pop-before-eol
+ - include: file-modes
+
+ # mode ..
+ # mode ,.. (for combined diff)
+ - match: '{{bol}}mode(?= [106475,.]+)'
+ scope: keyword.other.diff
+ push:
+ - include: pop-before-eol
+ - include: file-modes
+ - include: separator-twodot
+ # Combined mode can have multiple pre-commits
+ - include: separator-comma
+
+ # copy from
+ # copy to
+ # move from
+ # move to
+ # rename from
+ # rename to
+ - match: '{{bol}}((?:copy|move|rename) (?:from|to))[ \t]+'
+ captures:
+ 1: keyword.other.diff
+ push:
+ - meta_content_scope: meta.path.git string.unquoted.git
+ - include: pop-before-eol
+ - include: path-separators
+
+ # similarity index
+ # dissimilarity index
+ - match: '{{bol}}(?:dis)?similarity index'
+ scope: keyword.other.diff
+ push:
+ - include: pop-before-eol
+ - match: (100|[1-9]?[0-9])(%)
+ scope: meta.number.integer.decimal.git
+ captures:
+ 1: constant.numeric.value.git
+ 2: constant.numeric.suffix.git
+
+ # index ..
+ - match: '{{bol}}index(?= [0-9a-f,.]+)'
+ scope: keyword.other.diff
+ push:
+ - include: pop-before-eol
+ - include: file-modes
+ - include: hash-empty-content
+ - include: hash
+ - include: separator-twodot
+ # Combined mode can have multiple pre-commits
+ - include: separator-comma
+
+ diff-content:
+ - meta_content_scope: meta.block.delta.diff
+ - include: pop-before-diff-header
+ - include: diff-line-ranges
+ - include: diff-deltas
+
+###[ DELTAS ]##################################################################
+
+ diff-deltas:
+ - meta_prepend: true
+ - match: '{{bol}}(?=-- {{eol}})'
+ pop: 1
+ # https://github.com/git/git/commit/051308f6e9cebeb76b8fb4f52b7e9e7ce064445c
+ - match: '{{bol}}GIT binary patch'
+ scope: keyword.other.diff
+ push: binary-diff-delta-content
+
+ binary-diff-delta-content:
+ # Binary type
+ - match: '{{bol}}(delta|literal) ([0-9]+)'
+ captures:
+ 1: support.function.diff
+ 2: meta.number.integer.decimal.diff constant.numeric.value.diff
+
+ # Empty file
+ - match: '{{bol}}(H)cmV\?d00001$'
+ scope: constant.language.null.diff
+ captures:
+ 1: punctuation.definition.string.begin.diff
+
+ # Base85-encoded binary data
+ - match: '{{bol}}([A-Za-z]){{base85}}{1,66}$'
+ scope: meta.string.diff string.other.raw.diff
+ captures:
+ 1: punctuation.definition.string.begin.diff
+
+ # Bail if anything else is encountered
+ - match: '{{bol}}(?!delta|literal|$)'
+ pop: 2
+
+###[ COMBINED DIFF ]###########################################################
+
+ diff-line-ranges:
+ - meta_prepend: true
+ # https://git-scm.com/docs/diff-format#_combined_diff_format
+ - match: '{{bol}}(@@{2})(?=[^@\n]+@@{2}(?:\s|$))'
+ captures:
+ 1: punctuation.definition.range.begin.diff
+ push: [deltas-combined-2, hunk-name, inside-diff-line-ranges-combined]
+ - match: '{{bol}}(@@{3})(?=[^@\n]+@@{3}(?:\s|$))'
+ captures:
+ 1: punctuation.definition.range.begin.diff
+ push: [deltas-combined-3, hunk-name, inside-diff-line-ranges-combined]
+ - match: '{{bol}}(@@{4})(?=[^@\n]+@@{4}(?:\s|$))'
+ captures:
+ 1: punctuation.definition.range.begin.diff
+ push: [deltas-combined-4, hunk-name, inside-diff-line-ranges-combined]
+ - match: '{{bol}}(@@{5})(?=[^@\n]+@@{5}(?:\s|$))'
+ captures:
+ 1: punctuation.definition.range.begin.diff
+ push: [deltas-combined-5, hunk-name, inside-diff-line-ranges-combined]
+
+ deltas-combined-2:
+ - include: pop-empty-line
+ - match: '{{bol}}[ ]{2}'
+ - match: '{{bol}}[+ ]{2}'
+ scope: punctuation.definition.inserted.diff
+ push: line-inserted
+ - match: '{{bol}}[- ]{2}'
+ scope: punctuation.definition.deleted.diff
+ push: line-deleted
+ - match: '{{bol}}[\\/ ]{2}'
+ scope: punctuation.definition.comment.begin.diff
+ push: line-ignored
+ - match: '{{bol}}[+-]{2}'
+ scope: punctuation.definition.changed.diff
+ push: line-changed
+
+ deltas-combined-3:
+ - include: pop-empty-line
+ - match: '{{bol}}[ ]{3}'
+ - match: '{{bol}}[+ ]{3}'
+ scope: punctuation.definition.inserted.diff
+ push: line-inserted
+ - match: '{{bol}}[- ]{3}'
+ scope: punctuation.definition.deleted.diff
+ push: line-deleted
+ - match: '{{bol}}[\\/ ]{3}'
+ scope: punctuation.definition.comment.begin.diff
+ push: line-ignored
+ - match: '{{bol}}[+-]{3}'
+ scope: punctuation.definition.changed.diff
+ push: line-changed
+
+ deltas-combined-4:
+ - include: pop-empty-line
+ - match: '{{bol}}[ ]{4}'
+ - match: '{{bol}}[+ ]{4}'
+ scope: punctuation.definition.inserted.diff
+ push: line-inserted
+ - match: '{{bol}}[- ]{4}'
+ scope: punctuation.definition.deleted.diff
+ push: line-deleted
+ - match: '{{bol}}[\\/ ]{4}'
+ scope: punctuation.definition.comment.begin.diff
+ push: line-ignored
+ - match: '{{bol}}[+-]{4}'
+ scope: punctuation.definition.changed.diff
+ push: line-changed
+
+ deltas-combined-5:
+ - include: pop-empty-line
+ - match: '{{bol}}[ ]{5}'
+ - match: '{{bol}}[+ ]{5}'
+ scope: punctuation.definition.inserted.diff
+ push: line-inserted
+ - match: '{{bol}}[- ]{5}'
+ scope: punctuation.definition.deleted.diff
+ push: line-deleted
+ - match: '{{bol}}[\\/ ]{5}'
+ scope: punctuation.definition.comment.begin.diff
+ push: line-ignored
+ - match: '{{bol}}[+-]{5}'
+ scope: punctuation.definition.changed.diff
+ push: line-changed
+
+ inside-diff-line-ranges-combined:
+ - meta_scope: meta.diff.range.combined meta.range.combined.diff meta.toc-list.hunk.diff
+ - include: inside-diff-line-ranges-unified
+
+###[ COMPONENTS ]##############################################################
+
+ hash-empty-content:
+ - match: '0{7,64}'
+ scope: constant.language.null.git
+
+ hash:
+ - match: '{{git_hash}}'
+ scope: constant.other.hash.git
+
+ hash-full-length:
+ - match: '{{git_hash_full}}'
+ scope: constant.other.hash.git
+
+ separator-comma:
+ - match: \,
+ scope: punctuation.separator.sequence.git
+
+ separator-twodot:
+ - match: \.\.
+ scope: punctuation.separator.range.git
+
+ file-modes:
+ - match: \b(?:100)?644\b
+ scope: meta.number.integer.octal.diff constant.numeric.value.diff
+ - match: \b(?:100)?755\b
+ scope: meta.number.integer.octal.diff constant.numeric.value.diff storage.modifier.executable.diff
+
+###[ PROTOTYPES ]##############################################################
+
+ pop-empty-line:
+ - match: '{{empty_line}}'
+ pop: 1
+
+ pop-before-diff-header:
+ - match: '{{bol}}{{next_diff_header}}'
+ pop: 1
+
+ pop-before-next-email-header:
+ # Hack in `\` to support unit tests
+ - match: '{{bol}}(?! \S|\\)'
+ pop: 1
+
+###############################################################################
+
+variables:
+ git_hash: '[0-9a-fA-F]{7,64}'
+ day3: (?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)
+ month3: (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)
+ base85: '[0-9a-zA-Z!#$%&()*+\-;<=>?@^_`{|}~]'
+ empty_line: '{{bol}}(?=\n)'
+ scissors: (?:>8|8<)
+ # https://git-scm.com/docs/git-am#_discussion
+ next_diff_header: '(?=Index: |diff -)'
diff --git a/Git Formats/Git Log.sublime-syntax b/Git Formats/Git Log.sublime-syntax
index d773ca5e6e..202806b352 100644
--- a/Git Formats/Git Log.sublime-syntax
+++ b/Git Formats/Git Log.sublime-syntax
@@ -48,10 +48,9 @@ contexts:
- match: ','
scope: punctuation.separator.sequence.git.log
- match: (?={{diff_begin}})
- embed: scope:source.shell.bash
- escape: $
- - match: (?=^index\s)
- push: extended-patch-headers
+ embed: Git Diff.sublime-syntax#diffs
+ embed_scope: source.diff.git
+ escape: (?={{commit_begin}})
commit-header:
# All header attributes are mappings of `key: value` format.
@@ -72,48 +71,3 @@ contexts:
# https://github.com/SublimeTextIssues/Core/issues/2395
- match: ^
push: Git Commit Message.sublime-syntax
-
- extended-patch-headers:
- # https://git-scm.com/docs/git-show#_generating_patch_text_with_p
- - meta_scope: meta.diff.header.extended.git.log
- - match: ^(index)\s+
- captures:
- 1: keyword.context.git.log
- push: index
- - match: ^((?:new|deleted)\s+file\s+)?(mode)\s+
- captures:
- 1: keyword.context.git.log
- 2: keyword.context.git.log
- push: mode
- - match: ^((?:dis)?similarity\s+index)\s+
- captures:
- 1: keyword.context.git.log
- push: similarity-index
- - match: ^((?:copy|move)\s+(?:from|to))\s+
- captures:
- 1: keyword.context.git.log
- push: copy-or-move
- - match: ^
- pop: 1
- embed: scope:source.diff
- escape: '{{commit_or_diff_begin}}'
-
- index:
- - include: Git Common.sublime-syntax#commit
- - include: mode
-
- mode:
- - include: Git Common.sublime-syntax#eol-pop
- - match: ',|\.\.'
- scope: punctuation.separator.sequence.git.log
- - match: '[0-7]{6}'
- scope: meta.number.integer.octal.git.log constant.numeric.value.git.log
-
- similarity-index:
- - include: Git Common.sublime-syntax#eol-pop
- - match: \d+
- scope: meta.number.integer.decimal.git.log constant.numeric.value.git.log
-
- copy-or-move:
- - include: Git Common.sublime-syntax#eol-pop
- - include: Git Link.sublime-syntax#expect-path
diff --git a/Git Formats/tests/syntax_test_git_diff.patch b/Git Formats/tests/syntax_test_git_diff.patch
new file mode 100644
index 0000000000..44a27dcfad
--- /dev/null
+++ b/Git Formats/tests/syntax_test_git_diff.patch
@@ -0,0 +1,216 @@
+\ SYNTAX TEST partial-symbols "Packages/Git Formats/Git Diff.sublime-syntax"
+From 8f72bad1baf19a53459661343e21d6491c3908d3 Mon Sep 17 00:00:00 2001
+\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.diff
+\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.other.hash.git
+From: Tony Luck
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.git-header.diff
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.mapping.diff
+\^^^ keyword
+\ ^ punctuation.separator.mapping.key-value.diff
+\ ^^^^^^^^^ meta.reference.user.git
+\ ^^^^^^^^^^^^^^^^^^^^^ meta.reference.email.git
+\ ^ punctuation.definition.reference.email.begin.git
+\ ^^^^^^^^^^^^^^^^^^^ entity.name.reference.email.git
+\ ^ punctuation.separator.email.git
+\ ^ punctuation.separator.domain.git
+\ ^ punctuation.definition.reference.email.end.git
+Date: Tue, 13 Jul 2010 11:42:54 -0700
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.git-header.diff meta.mapping.diff
+\^^^ keyword
+\ ^ punctuation.separator.mapping.key-value.diff
+\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.numeric.value.diff
+\ ^ punctuation.separator.date.diff
+\ ^ punctuation.separator.date.diff
+\ ^ punctuation.separator.date.diff
+\ ^^^^^ storage.modifier.diff
+Subject: [PATCH v2 1/2] [IA64] Put ia64 config files on the Uwe Kleine-Koenig
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.git-header.diff meta.mapping.diff
+\ ^^ meta.annotation.patch-version.diff storage.modifier.diff
+\ ^^^ meta.annotation.patch-sequence.diff
+\^^^^^^ keyword
+\ ^ punctuation.separator.mapping.key-value.diff
+\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.heading.diff
+\ ^^^^^^^^^^^^^^ variable.annotation.diff
+\ ^ punctuation.definition.annotation.begin.diff
+\ ^ meta.number.integer.decimal.diff constant.numeric.value.diff
+\ ^ punctuation.separator.sequence.diff
+\ ^ meta.number.integer.decimal.diff constant.numeric.value.diff
+\ ^ punctuation.definition.annotation.end.diff
+ diet
+\^^^^^ meta.block.git-header.diff meta.mapping.diff markup.heading.diff
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.git-header.diff meta.mapping.diff
+\^^^^^^^^^^^ keyword.other.diff
+Content-Transfer-Encoding: 8bit
+
+arch/arm config files were slimmed down using a python script
+
+(See commit c2330e286f68f1c408b4aa6515ba49d57f05beae comment)
+\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.other.hash.git
+
+Do the same for ia64 so we can have sleek & trim looking
+
+-- >8 ----- >8 ----
+\^^^^^^^^^^^^^^^^^^ meta.block.git-header.diff punctuation.section.block.git
+\ ^^ support.function.scissors.git
+\ ^^ support.function.scissors.git
+Subject: [RFC PATCH v3] How about this instead?
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.git-header.diff meta.mapping.diff
+\ ^^^ storage.modifier.diff
+\ ^^ meta.annotation.patch-version.diff storage.modifier.diff
+\^^^^^^ keyword
+\ ^ punctuation.separator.mapping.key-value.diff
+\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.heading.diff
+\ ^^^^^^^^^^^^^^ variable.annotation.diff
+\ ^ punctuation.definition.annotation.begin.diff
+\ ^ punctuation.definition.annotation.end.diff
+
+> Do the same for ia64 so we can have sleek & trim looking
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.git-body.diff markup.quote.git
+\ <- punctuation.definition.blockquote.git
+
+Much better, no?
+\^^^^^^^^^^^^^^^^ meta.block.git-body.diff
+
+---
+ Gemfile | 1 +
+\@@@@@@@ local-definition
+\^^^^^^^ meta.toc-list.filename.diff meta.path.git string.unquoted.git
+\ ^ punctuation.separator.sequence.diff
+\ ^ meta.number.integer.decimal.diff constant.numeric.value.diff
+\ ^ markup.inserted.diff
+ app/assets/images/logo.jpeg | Bin 0 -> 50966 bytes
+\@@@@@@@@@@@@@@@@@@@@@@@@@@@ local-definition
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.toc-list.filename.diff meta.path.git string.unquoted.git
+\ ^ punctuation.separator.path.diff
+\ ^ punctuation.separator.path.diff
+\ ^ punctuation.separator.path.diff
+\ ^ punctuation.separator.sequence.diff
+\ ^^^ storage.type.diff
+\ ^ meta.number.integer.decimal.diff constant.numeric.value.diff markup.deleted.diff
+\ ^^ keyword.operator.logical.diff
+\ ^^^^^ meta.number.integer.decimal.diff constant.numeric.value.diff markup.inserted.diff
+\ ^^^^^ constant.numeric.suffix.diff
+ fonts/icomoon.eot | Bin 55452 -> 56000 bytes
+\@@@@@@@@@@@@@@@@@ local-definition
+ 3 files changed, 1 insertion(+)
+\^ meta.number.integer.decimal.diff constant.numeric.value.diff
+\ ^ punctuation.separator.sequence.diff
+\ ^ meta.number.integer.decimal.diff constant.numeric.value.diff
+\ ^^^^^^^^^^^^ markup.inserted.diff
+\ ^ punctuation.definition.diff
+\ ^ punctuation.definition.diff
+
+diff --git a/Gemfile b/Gemfile
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.header.diff meta.toc-list.git
+\^^^ meta.function-call.identifier.git variable.function.diff
+\ ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.git
+\ ^^^^^ variable.parameter.diff
+\ ^^ punctuation.definition.parameter.diff
+\ ^ variable.parameter.source.diff
+\ ^^^^^^^^ meta.path.diff string.unquoted.git
+\ ^ punctuation.separator.path.diff
+\ ^ variable.parameter.source.diff
+\ ^^^^^^^^ meta.path.diff string.unquoted.git
+\ ^ punctuation.separator.path.diff
+index c661619..989efe8 100644
+--- a/Gemfile
+\^^^^^^^^^^^^ meta.block.header.diff meta.diff.header.from-file meta.header.from-file.diff
+\^^ punctuation.definition.from-file.diff
+\ ^ variable.parameter.source.diff
+\ ^^^^^^^^ meta.path.diff string.unquoted.git
+\ ^ punctuation.separator.path.diff
++++ b/Gemfile
+\^^^^^^^^^^^^ meta.block.header.diff meta.diff.header.to-file meta.header.to-file.diff
+\^^ punctuation.definition.to-file.diff
+\ ^ variable.parameter.source.diff
+\ ^^^^^^^^ meta.path.diff string.unquoted.git
+\ ^ punctuation.separator.path.diff
+@@ -24,6 +24,7 @@ group :development do
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.delta.diff
+\^^^^^^^^^^^^^^^^ meta.diff.range.unified meta.range.unified.diff meta.toc-list.hunk.diff
+\^ punctuation.definition.range.begin.diff
+\ ^ support.function.diff
+\ ^ punctuation.separator.sequence.diff
+\ ^ support.function.diff
+\ ^ punctuation.separator.sequence.diff
+\ ^^ punctuation.definition.range.end.diff
+\ ^^^^^^^^^^^^^^^^^^^^^^ meta.toc-list.hunk.diff
+\ ^^^^^^^^^^^^^^^^^^^^^ entity.name.section.diff
+ gem 'listen', '~> 3.0.5'
+ gem 'spring'
+ gem 'spring-watcher-listen', '~> 2.0.0'
++ gem 'rspec-rails'
+ end
+
+ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
+diff --git a/app/assets/images/logo.jpeg b/app/assets/images/logo.jpeg
+new file mode 100644
+\^^^^^^^^^^^^^^^^^^^ meta.block.header.diff markup.inserted.diff
+\ ^^^^^^ meta.number.integer.octal.diff constant.numeric.value.diff
+index 0000000000000000000000000000000000000000..064fa38be3ecd426a3c8977ed43df627c6f6f229
+\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.header.diff
+\^^^^ keyword.other.diff
+\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.language.null.git
+\ ^^ punctuation.separator.range.git
+\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.other.hash.git
+GIT binary patch
+literal 50966
+zcmbT6RZtv2x1a}i2o6CLAUMHc&=7(LcbCE49fAa#;4l!}9R?j7La@Qz-3jh4+5Goz
+z?N;s6?w*#Hmg=v%T8{i(_`3mkBQGr{4M0Eu01*Bqz~5JZu%w!lgod)35UrItyREZ@
+z-----------------------------------------------------------------
+z-----------------------------------------------------------------
+z-----------------(hundreds_of_lines_of_Base85)-------------------
+z-----------------------------------------------------------------
+z-----------------------------------------------------------------
+z_i{8b#lS>d00-gEau-UmipEYM(5_o#RQj_ZJv9|UY@uA|M&a-
+z-#$F6-;kv%Bvq;)#8s9kMe~?~lS^$MkZ)X4mTqx{`@;`ELI}+Er-zU
+zUl2md1SWJF6ob$m4rAZM)XZ#OgtsGE?L8tCvF<&*1n|)5r5Oh{OuI|5sH(-)mvFIXhzEU8N
+z@nwnJB-fDvSrO8KR|jq#$oK_X1esyM3&aTI)9TfiNWBZE)Dvmw1q(E(Qzr!V#_1OV
+zBu}fGgb}_}=i$8<->JJ{QOy(Giwcy~b8$5Y?;}K@PTXgWETK8Hgl7zaD2O2_h=O;Q
+zC+wkUwiVd
+z_8-#%I8DI?w_1xdC5Qz2&eFK1qr~R0^kkKBt|r
+z*l8MortKES?)3T6VJwb)94`or#XwPpx{l^2{(S`T+TI#7-Oy~U>49Gf5+VVAi`f)z
+zmb_MmspadnB%wXpEwIhQsI64C+o)z+Ps0kn*Q&zIs6(tr2Xo+!MO{~=K;~gBY
+z$BXAU-YtrQvK)`g@}MZXtBhXX07_hF^1sRRPJf5(9w9V3qZ-g^M}35w!(O}Jag95~%{hN^4Q&5n#|8H_&yU_AUx~jg%r(C2-x*w!p2};{
+zU9mIqjl^%e|Jajg|Fk33+0%97^^5y1>~G!wJV_<5r+T^*2PO|4?7et+=*ZbVs{i@G
+vrJ>4OeEIG6k=hKGSs#6ty)`yHzHs!xL@3vqJCl3zj(|r8eEW-)I~(vf1`5_3~K=WNjf@&kbC+Y0iFOBk4eG7Q&&&S6ksU}l+|
+z%-F-oI{5>mIy-~t4$+OG-J9i@jtg%7D?0grjAd55Z#=)vR|am7^$ZMmcTV^QqbIMq
+zX3iKk`N=iy&EnUc8SA-c@j38?@MZAT2qp=B6Z$5+M1(_Rk*J+mg1DcAg`}L+25C3x
+zGMQttesXi b_date) ? -1 : (a_date == b_date) ? 0 : 1;
+\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.delta.diff - markup
+ }
+
+- static void describe(char *arg)
+\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.delta.diff markup.deleted.diff
+ -static void describe(struct commit *cmit, int last_one)
+\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.delta.diff markup.deleted.diff
+++static void describe(char *arg, int last_one)
+\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.delta.diff markup.inserted.diff
+ {
+ + unsigned char sha1[20];
+\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.delta.diff markup.inserted.diff
+ + struct commit *cmit;
+\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.delta.diff markup.inserted.diff
+ struct commit_list *list;
+\ <- meta.block.delta.diff - markup
+\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.delta.diff - markup
+ static int initialized = 0;
+ struct commit_name *n;
+
+ + if (get_sha1(arg, sha1) < 0)
+ + usage(describe_usage);
+ + cmit = lookup_commit_reference(sha1);
+ + if (!cmit)
+ + usage(describe_usage);
+ +
+ if (!initialized) {
++- initialized = 1;
+\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.delta.diff markup.changed.diff
+ for_each_ref(get_name);
diff --git a/Git Formats/tests/syntax_test_git_log b/Git Formats/tests/syntax_test_git_log
index ae94ce540c..2ab88e48e7 100644
--- a/Git Formats/tests/syntax_test_git_log
+++ b/Git Formats/tests/syntax_test_git_log
@@ -82,11 +82,10 @@ Date: Tue Aug 24 13:44:17 2021 -0400
[TypeScript] [TSX] Fix arrow function type parameter tests for TSX. (#2987)
diff --git a/JavaScript/TypeScript.sublime-syntax b/JavaScript/TypeScript.sublime-syntax
-#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.shell
-# ^ - source.shell
-#^^^ source.shell meta.function-call.identifier variable.function
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.diff.git
+#^^^ meta.function-call.identifier variable.function
# ^^ punctuation.definition.parameter
-# ^^^ variable.parameter.option
+# ^^^ variable.parameter
index ae1b1061..c1a585d0 100644
--- a/JavaScript/TypeScript.sublime-syntax
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.diff meta.diff.header meta.header.from-file
@@ -103,48 +102,82 @@ index ae1b1061..c1a585d0 100644
- # branch:
- # - ts-old-type-assertion
diff --git a/JavaScript/tests/syntax_test_typescript_not_tsx.ts b/JavaScript/tests/syntax_test_typescript_not_tsx.ts
-#^^^ source.shell meta.function-call.identifier variable.function
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.header.diff meta.toc-list.git
+#^^^ meta.function-call.identifier.git variable.function.diff
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.git
+# ^^^^^ variable.parameter.diff
+# ^^ punctuation.definition.parameter.diff
+# ^ variable.parameter.source.diff
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.path.diff string.unquoted.git
+# ^ punctuation.separator.path.diff
+# ^ punctuation.separator.path.diff
+# ^ punctuation.separator.path.diff
+# ^ variable.parameter.source.diff
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.path.diff string.unquoted.git
+# ^ punctuation.separator.path.diff
+# ^ punctuation.separator.path.diff
+# ^ punctuation.separator.path.diff
index c90bfab4,c90bfab4..e9338c70 100644
-#^^^^ keyword.context.git.log
-# ^^^^^^^^ constant.other.hash
-# ^ punctuation.separator.sequence.git.log
-# ^^^^^^^^ constant.other.hash
-# ^^ punctuation.separator.sequence.git.log
-# ^^^^^^^^ constant.other.hash
-# ^^^^^^ meta.number.integer.octal.git constant.numeric.value.git.log
-#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.diff.header.extended.git.log
-mode 012345,676543..701532
-#^^^ keyword.context.git.log
-# ^^^^^^ meta.number.integer.octal.git constant.numeric.value.git.log
-# ^ punctuation.separator.sequence.git.log
-# ^^^^^^ meta.number.integer.octal.git constant.numeric.value.git.log
-# ^^ punctuation.separator.sequence.git.log
-# ^^^^^^ meta.number.integer.octal.git constant.numeric.value.git.log
-new file mode 012345
-#^^^^^^^^^^^^ keyword.context.git.log
-# ^^^^^^ meta.number.integer.octal.git constant.numeric.value.git.log
-deleted file mode 012345,676543
-#^^^^^^^^^^^^^^^^ keyword.context.git.log
-# ^^^^^^ meta.number.integer.octal.git constant.numeric.value.git.log
-# ^ punctuation.separator.sequence.git.log
-# ^^^^^^ meta.number.integer.octal.git constant.numeric.value.git.log
-similarity index 983489374
-#^^^^^^^^^^^^^^^ keyword.context.git.log
-# ^^^^^^^^^ meta.number.integer.decimal.git constant.numeric.value.git.log
-dissimilarity index 72637263
-#^^^^^^^^^^^^^^^^^^ keyword.context.git.log
-# ^^^^^^^^ meta.number.integer.decimal.git constant.numeric.value.git.log
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.diff.git meta.block.header.diff
+#^^^^ keyword.other.diff
+# ^^^^^^^^ constant.other.hash.git
+# ^ punctuation.separator.sequence.git
+# ^^^^^^^^ constant.other.hash.git
+# ^^ punctuation.separator.range.git
+# ^^^^^^^^ constant.other.hash.git
+# ^^^^^^ meta.number.integer.octal.diff constant.numeric.value.diff
+mode 100644,100755..755
+#^^^^^^^^^^^^^^^^^^^^^^ source.diff.git meta.block.header.diff
+#^^^ keyword.other.diff
+# ^^^^^^ meta.number.integer.octal.diff constant.numeric.value.diff
+# ^ punctuation.separator.sequence.git
+# ^^^^^^ meta.number.integer.octal.diff constant.numeric.value.diff storage.modifier.executable.diff
+# ^^ punctuation.separator.range.git
+# ^^^ meta.number.integer.octal.diff constant.numeric.value.diff storage.modifier.executable.diff
+new file mode 644
+#^^^^^^^^^^^^^^^^ source.diff.git meta.block.header.diff markup.inserted.diff
+# ^^^ meta.number.integer.octal.diff constant.numeric.value.diff
+deleted file mode 644,755
+#^^^^^^^^^^^^^^^^^^^^^^^^ source.diff.git meta.block.header.diff markup.deleted.diff
+# ^^^ meta.number.integer.octal.diff constant.numeric.value.diff
+# ^ punctuation.separator.sequence.git
+# ^^^ meta.number.integer.octal.diff constant.numeric.value.diff storage.modifier.executable.diff
+similarity index 89%
+#^^^^^^^^^^^^^^^^^^^ source.diff.git meta.block.header.diff
+#^^^^^^^^^^^^^^^ keyword.other.diff
+# ^^^ meta.number.integer.decimal.git
+# ^^ constant.numeric.value.git
+# ^ constant.numeric.suffix.git
+dissimilarity index 4%
+#^^^^^^^^^^^^^^^^^^^^^ source.diff.git meta.block.header.diff
+#^^^^^^^^^^^^^^^^^^ keyword.other.diff
+# ^^ meta.number.integer.decimal.git
+# ^ constant.numeric.value.git
+# ^ constant.numeric.suffix.git
copy from JavaScript/tests/syntax_test_typescript_not_tsx.ts
-#^^^^^^^^ keyword.context.git.log
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.diff.git meta.block.header.diff
+#^^^^^^^^ keyword.other.diff
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.path.git string.unquoted.git
+# ^ punctuation.separator.path.diff
+# ^ punctuation.separator.path.diff
move to JavaScript/tests/syntax_test_typescript_not_tsx.ts
-#^^^^^^ keyword.context.git.log
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.diff.git meta.block.header.diff
+#^^^^^^ keyword.other.diff
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.path.git string.unquoted.git
-#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.diff.header.extended.git.log
+# ^ punctuation.separator.path.diff
+# ^ punctuation.separator.path.diff
--- a/JavaScript/tests/syntax_test_typescript_not_tsx.ts
-#<- - meta.diff.header.extended
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.header.diff meta.diff.header.from-file meta.header.from-file.diff
+#^^ punctuation.definition.from-file.diff
+# ^ punctuation.separator.path.diff
+# ^ punctuation.separator.path.diff
+# ^ punctuation.separator.path.diff
+++ b/JavaScript/tests/syntax_test_typescript_not_tsx.ts
-#^^ source.diff meta.diff.header meta.header.to-file punctuation.definition.to-file
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.header.diff meta.diff.header.to-file meta.header.to-file.diff
+#^^ punctuation.definition.to-file.diff
+# ^ punctuation.separator.path.diff
+# ^ punctuation.separator.path.diff
+# ^ punctuation.separator.path.diff
@@ -25,3 +25,12 @@
let strLength: number = (someValue).length; //
// ^^^^^^^^ meta.assertion - meta.tag
diff --git a/Markdown/Embeddings/Diff (for Markdown).sublime-syntax b/Markdown/Embeddings/Diff (for Markdown).sublime-syntax
new file mode 100644
index 0000000000..f49afec111
--- /dev/null
+++ b/Markdown/Embeddings/Diff (for Markdown).sublime-syntax
@@ -0,0 +1,11 @@
+%YAML 1.2
+---
+scope: source.diff.embedded.markdown
+version: 2
+hidden: true
+
+extends:
+ - Packages/Diff/Diff.sublime-syntax
+
+variables:
+ bol: ^\s*
diff --git a/Markdown/Markdown.sublime-syntax b/Markdown/Markdown.sublime-syntax
index 7cd66b7139..d3161a7d4e 100644
--- a/Markdown/Markdown.sublime-syntax
+++ b/Markdown/Markdown.sublime-syntax
@@ -1303,7 +1303,7 @@ contexts:
5: constant.other.language-name.markdown
6: comment.line.infostring.markdown
7: meta.fold.code-fence.begin.markdown
- embed: scope:source.diff
+ embed: scope:source.diff.embedded.markdown
embed_scope:
markup.raw.code-fence.diff.markdown-gfm
source.diff
diff --git a/Markdown/tests/syntax_test_markdown.md b/Markdown/tests/syntax_test_markdown.md
index 7ce426db9f..8318af172d 100644
--- a/Markdown/tests/syntax_test_markdown.md
+++ b/Markdown/tests/syntax_test_markdown.md
@@ -1878,6 +1878,30 @@ $ cmd # no interactive shell marker
|^^ meta.code-fence.definition.end.diff.markdown-gfm punctuation.definition.raw.code-fence.end.markdown
| ^ meta.code-fence.definition.end.diff.markdown-gfm meta.fold.code-fence.end - punctuation
+1. list item with diff fenced code block
+
+ ```diff
+ <<<<<<< A
+ \^^^^^^^^^ meta.block.conflict.begin.diff - meta.block meta.block - markup
+ \^^^^^^ punctuation.section.block.begin.diff
+ \ ^ - entity - punctuation
+ \ ^ entity.name.section.diff
+ \ ^ - entity
+ lines from A
+ \^^^^^^^^^^^^ meta.block.conflict.diff markup.deleted.diff - meta.block meta.block
+ =======
+ \^^^^^^^ meta.block.conflict.separator.diff - meta.block meta.block - markup
+ \^^^^^^ punctuation.section.block.diff
+ lines from B
+ \^^^^^^^^^^^ meta.block.conflict.diff markup.inserted.diff
+ >>>>>>> B
+ \^^^^^^^^^ meta.block.conflict.end.diff - meta.block meta.block - markup
+ \^^^^^^ punctuation.section.block.end.diff
+ \ ^ - entity
+ \ ^ entity.name.section.diff
+ \ ^ - entity
+ ```
+
```dot
|^^^^^ meta.code-fence.definition.begin - meta.fold
| ^ meta.code-fence.definition.begin meta.fold.code-fence.begin
diff --git a/PHP/Embeddings/Diff (for PHP Interpolated).sublime-syntax b/PHP/Embeddings/Diff (for PHP Interpolated).sublime-syntax
index 09d9adc406..6e089a3a1c 100644
--- a/PHP/Embeddings/Diff (for PHP Interpolated).sublime-syntax
+++ b/PHP/Embeddings/Diff (for PHP Interpolated).sublime-syntax
@@ -1,7 +1,7 @@
%YAML 1.2
---
scope: source.diff.interpolated.php
-# version: 2
+version: 2
hidden: true
extends: Packages/Diff/Diff.sublime-syntax