Skip to content

Commit

Permalink
Preliminary work on issue atom#61
Browse files Browse the repository at this point in the history
Add repository property to Pattern class, and change code in Pattern.ruleForInclude to account for that change.
  • Loading branch information
Talon1024 committed Apr 16, 2016
1 parent f8c1f2b commit 707363f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/pattern.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ DigitRegex = /\\\d+/
module.exports =
class Pattern
constructor: (@grammar, @registry, options={}) ->
{name, contentName, match, begin, end, patterns} = options
{name, contentName, match, begin, end, patterns, repository} = options
{captures, beginCaptures, endCaptures, applyEndPatternLast} = options
{@include, @popRule, @hasBackReferences} = options

@pushRule = null
@backReferences = null
@scopeName = name
@contentScopeName = contentName
@repository = repository

if match
if (end or @popRule) and @hasBackReferences ?= DigitRegex.test(match)
Expand Down Expand Up @@ -97,7 +98,10 @@ class Pattern
ruleForInclude: (baseGrammar, name) ->
hashIndex = name.indexOf('#')
if hashIndex is 0
@grammar.getRepository()[name[1..]]
rule = @grammar.getRepository()[name[1..]]
if not repo?
rule = @repository?[name[1..]]
rule
else if hashIndex >= 1
grammarName = name[0..hashIndex-1]
ruleName = name[hashIndex+1..]
Expand Down

0 comments on commit 707363f

Please sign in to comment.