Struct syntect::highlighting::ScopeSelectors
[−]
[src]
pub struct ScopeSelectors { pub selectors: Vec<ScopeSelector>, }
A selector set that matches anything matched by any of its component selectors. See The TextMate Docs for how these work.
Fields
selectors: Vec<ScopeSelector>
the selectors, if any of them match, this matches
Methods
impl ScopeSelectors
[src]
fn does_match(&self, stack: &[Scope]) -> Option<MatchPower>
checks if any of these selectors match the given scope stack if so it returns a match score, higher match scores are stronger matches. Scores are ordered according to the rules found at https://manual.macromates.com/en/scope_selectors
Examples
use syntect::parsing::{ScopeStack, MatchPower}; use syntect::highlighting::ScopeSelectors; use std::str::FromStr; assert_eq!(ScopeSelectors::from_str("a.b, a e.f - c k, e.f - a.b").unwrap() .does_match(ScopeStack::from_str("a.b c.d j e.f").unwrap().as_slice()), Some(MatchPower(0o2001u64 as f64)));
Trait Implementations
impl Debug for ScopeSelectors
[src]
impl Clone for ScopeSelectors
[src]
fn clone(&self) -> ScopeSelectors
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl PartialEq for ScopeSelectors
[src]
fn eq(&self, __arg_0: &ScopeSelectors) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &ScopeSelectors) -> bool
This method tests for !=
.
impl Eq for ScopeSelectors
[src]
impl Default for ScopeSelectors
[src]
fn default() -> ScopeSelectors
Returns the "default value" for a type. Read more
impl FromStr for ScopeSelectors
[src]
type Err = ParseScopeError
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<ScopeSelectors, ParseScopeError>
Parses a series of selectors separated by commas or pipes