Skip to content

Commit

Permalink
fix(pilota-thrift-parser): compatible with separators after different…
Browse files Browse the repository at this point in the history
… item blocks in idl
  • Loading branch information
Ggiggle committed Nov 5, 2024
1 parent 765a699 commit 7d76794
Show file tree
Hide file tree
Showing 8 changed files with 1,030 additions and 7 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.

1,001 changes: 1,001 additions & 0 deletions pilota-build/test_data/thrift/separator.rs

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions pilota-build/test_data/thrift/separator.thrift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
typedef i32 MyInt32
typedef string MyString;

struct TypedefTestStruct {
1: MyInt32 field_MyInt32;
2: MyString field_MyString;
3: i32 field_Int32;
4: string field_String;
};

typedef TypedefTestStruct MyStruct,

const list<string> TEST_LIST = [
"hello",
"world",
];

service Service {
MyStruct testEpisode(1:MyStruct arg)
},
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.3"
version = "0.11.4"
edition = "2021"
description = "Pilota thrift Parser."
documentation = "https://docs.rs/pilota"
Expand Down
3 changes: 1 addition & 2 deletions pilota-thrift-parser/src/parser/enum_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ 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(),
Expand Down
3 changes: 2 additions & 1 deletion pilota-thrift-parser/src/parser/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ impl Parser for Service {
tag("}"),
opt(blank),
opt(Annotations::parse),
opt(list_separator),
)),
|(_, _, name, extends, _, _, functions, _, _, _, annotations)| Service {
|(_, _, name, extends, _, _, functions, _, _, _, annotations, _)| Service {
name,
extends,
functions,
Expand Down
3 changes: 2 additions & 1 deletion pilota-thrift-parser/src/parser/struct_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ impl Parser for StructLike {
tag("}"),
opt(blank),
opt(Annotations::parse),
opt(list_separator),
)),
|(name, _, _, fields, _, _, _, annotations)| StructLike {
|(name, _, _, fields, _, _, _, annotations, _)| StructLike {
name,
fields,
annotations: annotations.unwrap_or_default(),
Expand Down
3 changes: 2 additions & 1 deletion pilota-thrift-parser/src/parser/typedef.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ impl Parser for Typedef {
Ident::parse,
opt(blank),
opt(Annotations::parse),
opt(list_separator),
)),
|(_, _, r#type, _, alias, _, annotations)| Typedef {
|(_, _, r#type, _, alias, _, annotations, _)| Typedef {
r#type,
alias,
annotations: annotations.unwrap_or_default(),
Expand Down

0 comments on commit 7d76794

Please sign in to comment.