Skip to content

Commit f3b771d

Browse files
committed
fix (rust): add a negative lookahead for destructuring in function arguments to better capture complex function signatures
1 parent c98eae4 commit f3b771d

4 files changed

Lines changed: 15 additions & 1 deletion

File tree

.mcp_server.pid

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4104940

tests/more_languages/group4/rust_test.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,4 +229,12 @@ fn encode_pipeline(cmds: &[Cmd], atomic: bool) -> Vec<u8> {
229229
let mut rv = vec![];
230230
write_pipeline(&mut rv, cmds, atomic);
231231
rv
232+
}
233+
234+
pub async fn handle_post_yeet(
235+
State(auth_backend): State<AuthBackend>,
236+
Session { maybe_claims }: Session,
237+
Form(yeet_form): Form<YeetForm>,
238+
) -> Result<Response, AuthError> {
239+
println!("yeet yeet!")
232240
}

tests/test_more_language_units.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,6 +1314,11 @@ def test_more_languages_group3(file: str, expected: List[str]):
13141314
}): Path<RouteParams>,
13151315
) -> ServerResult<Response>""",
13161316
"fn encode_pipeline(cmds: &[Cmd], atomic: bool) -> Vec<u8>",
1317+
"""pub async fn handle_post_yeet(
1318+
State(auth_backend): State<AuthBackend>,
1319+
Session { maybe_claims }: Session,
1320+
Form(yeet_form): Form<YeetForm>,
1321+
) -> Result<Response, AuthError>""",
13171322
],
13181323
),
13191324
(

tree_plus_src/parse_file.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1212,7 +1212,7 @@ def parse_rs(
12121212

12131213
combined_pattern = regex.compile(
12141214
# functions
1215-
r"^(?P<function>\s*(?P<maybe_pub>pub\s+?)?(?P<maybe_async_or_const>(?:async|const)\s+)?(?P<fn>fn)\s+(?P<fn_name>\w+)(?P<generics><[^>]*?>)?(?P<argument_start>\()(?P<arguments>[&\w,':[\]()<>${}\/\s]+?)?(?P<argument_end>\))[\s\S]*?)(?P<end>(?:;\s)|(?:{))|"
1215+
r"^(?P<function>\s*(?P<maybe_pub>pub\s+?)?(?P<maybe_async_or_const>(?:async|const)\s+)?(?P<fn>fn)\s+(?P<fn_name>\w+)(?P<generics><[^>]*?>)?(?P<argument_start>\()(?P<arguments>[&\w,':[\]()<>${}\/\s]+?)?(?P<argument_end>\)(?!:))[\s\S]*?)(?P<end>(?:;\s)|(?:{))|"
12161216
# structs and impls with generics
12171217
r"\n(?P<struct_impl>(?: *((?:pub\s+)?struct)|impl)[^{;]*?) ?[{;]|"
12181218
# enum with variants

0 commit comments

Comments
 (0)