Skip to content

Commit

Permalink
Deprecate outdated path syntax (#685)
Browse files Browse the repository at this point in the history
  • Loading branch information
nwagner84 authored Aug 16, 2023
1 parent e0d9374 commit 061ecd4
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 11 deletions.
14 changes: 10 additions & 4 deletions pica-path/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ fn parse_path_simple(i: &[u8]) -> ParseResult<Path> {
)(i)
}

fn parse_path_depricated(i: &[u8]) -> ParseResult<Path> {
map(
fn parse_path_deprecated(i: &[u8]) -> ParseResult<Path> {
let (i, path) = map(
delimited(
multispace0,
tuple((
Expand Down Expand Up @@ -204,7 +204,13 @@ fn parse_path_depricated(i: &[u8]) -> ParseResult<Path> {
subfield_matcher: m,
codes: c,
},
)(i)
)(i)?;

if path.subfield_matcher.is_some() {
eprintln!("WARNING: Specifying subfield matcher in the first position of an path expression is deprecated. Please use the set-builder notation instead.");
}

Ok((i, path))
}

fn parse_path_curly(i: &[u8]) -> ParseResult<Path> {
Expand Down Expand Up @@ -253,7 +259,7 @@ fn parse_path_curly(i: &[u8]) -> ParseResult<Path> {
}

pub fn parse_path(i: &[u8]) -> ParseResult<Path> {
alt((parse_path_simple, parse_path_curly, parse_path_depricated))(i)
alt((parse_path_simple, parse_path_curly, parse_path_deprecated))(i)
}

pub trait PathExt<T: AsRef<[u8]>> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ bin.name = "pica"
args = "frequency -s \"065R{4 =^ 'ort', 9}\" dump.dat.gz"
status = "success"
stdout = "041178548,2\n040660095,1\n040787044,1\n"
stderr = ""
stderr = "WARNING: Specifying subfield matcher in the first position of an path expression is deprecated. Please use the set-builder notation instead.\n"
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ bin.name = "pica"
args = "frequency -s -i \"065R{4 =^ 'ORT', 9}\" dump.dat.gz"
status = "success"
stdout = "041178548,2\n040660095,1\n040787044,1\n"
stderr = ""
stderr = "WARNING: Specifying subfield matcher in the first position of an path expression is deprecated. Please use the set-builder notation instead.\n"
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ bin.name = "pica"
args = "-c Pica.toml frequency \"029@{a =^ 'Städtische', a}\""
status = "success"
stdout = "Sta\u0308dtische Pressestelle,1\n"
stderr = ""
stderr = "WARNING: Specifying subfield matcher in the first position of an path expression is deprecated. Please use the set-builder notation instead.\n"
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ bin.name = "pica"
args = "frequency \"029@{a =^ 'Städtische', a}\""
status = "success"
stdout = ""
stderr = ""
stderr = "WARNING: Specifying subfield matcher in the first position of an path expression is deprecated. Please use the set-builder notation instead.\n"
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ bin.name = "pica"
args = "-c Pica.toml select -s \"[email protected], 029@{a =^ 'Städtische', a}\""
status = "success"
stdout = "040181189,Sta\u0308dtische Pressestelle\n"
stderr = ""
stderr = "WARNING: Specifying subfield matcher in the first position of an path expression is deprecated. Please use the set-builder notation instead.\n"
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ bin.name = "pica"
args = "select -s \"[email protected], 029@{a =^ 'Städtische', a}\""
status = "success"
stdout = "040181189,\n"
stderr = ""
stderr = "WARNING: Specifying subfield matcher in the first position of an path expression is deprecated. Please use the set-builder notation instead.\n"

Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ args = "select -s \"044K{!9? && a !~ '^:[zf]', a}\""
status = "success"
stdin = "044K \u001fbckw\u001fa:z Geschichte 2005-2017\u001fEa\u001fHstwgnd\u001fK1\u001fD2022-07-15\u001e\n"
stdout = ""
stderr = ""
stderr = "WARNING: Specifying subfield matcher in the first position of an path expression is deprecated. Please use the set-builder notation instead.\n"

0 comments on commit 061ecd4

Please sign in to comment.