Skip to content

Commit

Permalink
fix(pilota-thrift-parser): trim extra whitespace characters at the en…
Browse files Browse the repository at this point in the history
…d of annotation list item (#281)

* fix(pilota-thrift-parser): trim extra whitespace characters at the end of annotation list

* fix(pilota-thrift-parser): add the list end blank test case for annotation parser
  • Loading branch information
Ggiggle authored Nov 4, 2024
1 parent b1078bc commit 34d6fd4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pilota-thrift-parser/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pilota-thrift-parser"
version = "0.11.2"
version = "0.11.3"
edition = "2021"
description = "Pilota thrift Parser."
documentation = "https://docs.rs/pilota"
Expand Down
9 changes: 9 additions & 0 deletions pilota-thrift-parser/src/parser/annotation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,14 @@ mod tests {
#[test]
fn test_annotations() {
let _a = Annotations::parse(r#"(go.tag = "json:\"Ids\" split:\"type=tenant\"")"#).unwrap();

let input = r#"(
cpp.type = "DenseFoo",
python.type = "DenseFoo",
java.final = "",
)"#;
let (remain, a) = Annotations::parse(input).unwrap();
assert!(remain.is_empty());
assert_eq!(a.len(), 3);
}
}
2 changes: 1 addition & 1 deletion pilota-thrift-parser/src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl Parser for Path {
}

pub(crate) fn list_separator(input: &str) -> IResult<&str, char> {
one_of(",;")(input)
map(tuple((one_of(",;"), opt(blank))), |(sep, _)| sep)(input)
}

fn comment(input: &str) -> IResult<&str, &str> {
Expand Down

0 comments on commit 34d6fd4

Please sign in to comment.