mirror of
https://github.com/atom/atom.git
synced 2026-02-07 13:14:55 -05:00
Only check for back references in end patterns
Back references can occur in match values but should not be treated differently when present there since they refer to groups inside the match. Close #370
This commit is contained in:
@@ -159,10 +159,10 @@ class Pattern
|
||||
backReferences: null
|
||||
anchored: false
|
||||
|
||||
constructor: (@grammar, { name, contentName, @include, match, begin, end, captures, beginCaptures, endCaptures, patterns, @popRule, hasBackReferences}) ->
|
||||
constructor: (@grammar, { name, contentName, @include, match, begin, end, captures, beginCaptures, endCaptures, patterns, @popRule, @hasBackReferences}) ->
|
||||
@scopeName = name ? contentName # TODO: We need special treatment of contentName
|
||||
if match
|
||||
if @hasBackReferences = hasBackReferences ? /\\\d+/.test(match)
|
||||
if (end or @popRule) and @hasBackReferences ?= /\\\d+/.test(match)
|
||||
@match = match
|
||||
else
|
||||
@regexSource = match
|
||||
|
||||
Reference in New Issue
Block a user