diff --git a/spec/app/text-mate-scope-selector-spec.coffee b/spec/app/text-mate-scope-selector-spec.coffee index 8e6e071b5..392c22b77 100644 --- a/spec/app/text-mate-scope-selector-spec.coffee +++ b/spec/app/text-mate-scope-selector-spec.coffee @@ -21,6 +21,9 @@ describe "TextMateScopeSelector", -> expect(new TextMateScopeSelector('a_b_c').matches(['a_b_c'])).toBeTruthy() expect(new TextMateScopeSelector('a_b_c').matches(['a_b'])).toBeFalsy() + it "matches filters", -> + expect(new TextMateScopeSelector('R:g').matches(['g'])).toBeTruthy() + it "matches disjunction", -> expect(new TextMateScopeSelector('a | b').matches(['b'])).toBeTruthy() expect(new TextMateScopeSelector('a|b|c').matches(['c'])).toBeTruthy() diff --git a/src/app/text-mate-scope-selector-pattern.pegjs b/src/app/text-mate-scope-selector-pattern.pegjs index 108b0cd2b..43d434644 100644 --- a/src/app/text-mate-scope-selector-pattern.pegjs +++ b/src/app/text-mate-scope-selector-pattern.pegjs @@ -30,8 +30,21 @@ group return selector; } +filter + = prefix:([LRB]":") _ group:group { + return group; + } + + / prefix:([LRB]":") _ path:path { + return path; + } + expression - = "-" _ group:group _ { + = "-" _ filter:filter _ { + return new matchers.NegateMatcher(filter); + } + + / "-" _ group:group _ { return new matchers.NegateMatcher(group); } @@ -39,6 +52,8 @@ expression return new matchers.NegateMatcher(path); } + / filter + / group / path