mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-20 23:48:05 +03:00
Add filter support to selector grammar
Currently these are unimplemented but they can now be parsed successfully since they are used by certain snippets.
This commit is contained in:
parent
a72e1813e9
commit
a98791ebd0
@ -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_c'])).toBeTruthy()
|
||||||
expect(new TextMateScopeSelector('a_b_c').matches(['a_b'])).toBeFalsy()
|
expect(new TextMateScopeSelector('a_b_c').matches(['a_b'])).toBeFalsy()
|
||||||
|
|
||||||
|
it "matches filters", ->
|
||||||
|
expect(new TextMateScopeSelector('R:g').matches(['g'])).toBeTruthy()
|
||||||
|
|
||||||
it "matches disjunction", ->
|
it "matches disjunction", ->
|
||||||
expect(new TextMateScopeSelector('a | b').matches(['b'])).toBeTruthy()
|
expect(new TextMateScopeSelector('a | b').matches(['b'])).toBeTruthy()
|
||||||
expect(new TextMateScopeSelector('a|b|c').matches(['c'])).toBeTruthy()
|
expect(new TextMateScopeSelector('a|b|c').matches(['c'])).toBeTruthy()
|
||||||
|
@ -30,8 +30,21 @@ group
|
|||||||
return selector;
|
return selector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
filter
|
||||||
|
= prefix:([LRB]":") _ group:group {
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
|
||||||
|
/ prefix:([LRB]":") _ path:path {
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
expression
|
expression
|
||||||
= "-" _ group:group _ {
|
= "-" _ filter:filter _ {
|
||||||
|
return new matchers.NegateMatcher(filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/ "-" _ group:group _ {
|
||||||
return new matchers.NegateMatcher(group);
|
return new matchers.NegateMatcher(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,6 +52,8 @@ expression
|
|||||||
return new matchers.NegateMatcher(path);
|
return new matchers.NegateMatcher(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/ filter
|
||||||
|
|
||||||
/ group
|
/ group
|
||||||
|
|
||||||
/ path
|
/ path
|
||||||
|
Loading…
Reference in New Issue
Block a user