From e61992c1f69c3f85adf281d133706afde062e0ee Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 6 Aug 2013 15:21:31 -0700 Subject: [PATCH] Allow _ characters in selector segments --- spec/app/text-mate-scope-selector-spec.coffee | 2 ++ src/app/text-mate-scope-selector-pattern.pegjs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/app/text-mate-scope-selector-spec.coffee b/spec/app/text-mate-scope-selector-spec.coffee index 35b4de613..f31ba945e 100644 --- a/spec/app/text-mate-scope-selector-spec.coffee +++ b/spec/app/text-mate-scope-selector-spec.coffee @@ -18,6 +18,8 @@ describe "TextMateScopeSelector", -> expect(new TextMateScopeSelector('a.b').matches(['a.b-d'])).toBeFalsy() expect(new TextMateScopeSelector('c++').matches(['c++'])).toBeTruthy() expect(new TextMateScopeSelector('c++').matches(['c'])).toBeFalsy() + expect(new TextMateScopeSelector('a_b_c').matches(['a_b_c'])).toBeTruthy() + expect(new TextMateScopeSelector('a_b_c').matches(['a_b'])).toBeFalsy() it "matches disjunction", -> expect(new TextMateScopeSelector('a | b').matches(['b'])).toBeTruthy() diff --git a/src/app/text-mate-scope-selector-pattern.pegjs b/src/app/text-mate-scope-selector-pattern.pegjs index 9965d6337..89045ea39 100644 --- a/src/app/text-mate-scope-selector-pattern.pegjs +++ b/src/app/text-mate-scope-selector-pattern.pegjs @@ -7,7 +7,7 @@ start = _ selector:(selector) _ { } segment - = _ segment:([a-zA-Z0-9+]+[a-zA-Z0-9-+]*) _ { + = _ segment:([a-zA-Z0-9+_]+[a-zA-Z0-9-+_]*) _ { return new matchers.SegmentMatcher(segment); }