Skip to main content

parse_condition

Function parse_condition 

Source
pub fn parse_condition(spec: &str) -> Result<Query>
Expand description

Parse a one-word findrefs condition, as the CLI’s compound and rule options take them:

  • string:REGEX, literal:TEXT, type:PATTERN
  • method:TARGET, field:TARGET: any member target form (as in member_query), e.g. android.webkit.WebView->loadUrl; the class is exact unless prefixed ~ (fuzzy) or written without package, the name a regex / substring unless prefixed = or followed by a signature (exact)
  • method:{RULE}: calls of the methods whose code matches RULE
  • method:@FILE: calls of the methods FILE lists, one per line
  • extends:CLASS, impl:CLASS

The kind is read by parse_kind (methods:, Method: work too); the grammar is crate::condition’s.

§Errors

EngineError::Query for a syntax error, an unknown kind, an invalid value, or a rule of several conditions.