griz-core 0.6.4

Pure edit engine for griz: find, plan, match, diff, and merge without writing
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! The `pattern` locator: an alternative to `find`/`range` that locates a
//! [`crate::Op::Replace`] by syntax shape instead of by text.

use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

/// A structural pattern that locates an edit inside one file.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
#[serde(deny_unknown_fields)]
pub struct PatternLocator {
    /// Structural pattern, e.g. `foo($A, $$$REST)`.
    pub pattern: String,
    /// Language to parse with; defaults to the file's extension.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub language: Option<String>,
}