From 99e45fe5260db810ad6282e559840795c37d0d8d Mon Sep 17 00:00:00 2001 From: LIU JIE Date: Wed, 6 Nov 2024 15:37:35 +0800 Subject: [PATCH] fix(pilota-thrift-parser): match comment after annotations in EnumValue (#287) --- Cargo.lock | 2 +- pilota-thrift-parser/Cargo.toml | 2 +- pilota-thrift-parser/src/parser/enum_.rs | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0d03c2c..efb12a4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -884,7 +884,7 @@ dependencies = [ [[package]] name = "pilota-thrift-parser" -version = "0.11.4" +version = "0.11.5" dependencies = [ "nom", ] diff --git a/pilota-thrift-parser/Cargo.toml b/pilota-thrift-parser/Cargo.toml index 2fde13b..8c8a57c 100644 --- a/pilota-thrift-parser/Cargo.toml +++ b/pilota-thrift-parser/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pilota-thrift-parser" -version = "0.11.4" +version = "0.11.5" edition = "2021" description = "Pilota thrift Parser." documentation = "https://docs.rs/pilota" diff --git a/pilota-thrift-parser/src/parser/enum_.rs b/pilota-thrift-parser/src/parser/enum_.rs index ee82fdf..2cd1a82 100644 --- a/pilota-thrift-parser/src/parser/enum_.rs +++ b/pilota-thrift-parser/src/parser/enum_.rs @@ -23,8 +23,9 @@ impl Parser for EnumValue { opt(blank), opt(Annotations::parse), opt(list_separator), + opt(blank), )), - |(name, _, value, _, annotations, _)| EnumValue { + |(name, _, value, _, annotations, _, _)| EnumValue { name, value, annotations: annotations.unwrap_or_default(), @@ -66,7 +67,7 @@ mod tests { let (_remain, _e) = Enum::parse( r#"enum Sex { UNKNOWN = 0, - MALE = 1, + MALE = 1 (pilota.key="male") // male FEMALE = 2, }"#, )