Skip to content
This repository was archived by the owner on Nov 5, 2024. It is now read-only.

Commit fe60119

Browse files
committed
change LIB_RUBY_PARSER_parse fn to take input and then options
1 parent 04225f0 commit fe60119

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ LIB_RUBY_PARSER_ParserOptions options = {
1616
.record_tokens = false,
1717
.token_rewriter = {.token_rewriter = {.f = NULL}}};
1818

19-
LIB_RUBY_PARSER_ParserResult result = LIB_RUBY_PARSER_parse(options, input);
19+
LIB_RUBY_PARSER_ParserResult result = LIB_RUBY_PARSER_parse(input, options);
2020
```
2121
2222
Parser input:

api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ static void test_parse(void)
1616

1717
LIB_RUBY_PARSER_ByteList input = LIB_RUBY_PARSER_new_bytes_from_cstr("2 + 3", 5);
1818

19-
LIB_RUBY_PARSER_ParserResult result = LIB_RUBY_PARSER_parse(options, input);
19+
LIB_RUBY_PARSER_ParserResult result = LIB_RUBY_PARSER_parse(input, options);
2020

2121
assert_eq(result.ast->tag, LIB_RUBY_PARSER_NODE_SEND);
2222
assert_eq(result.tokens.len, 4); // tINT tPLUS tINT EOF

api.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
This is the main entrypoint API.
1010
*/
1111
LIB_RUBY_PARSER_ParserResult LIB_RUBY_PARSER_parse(
12-
LIB_RUBY_PARSER_ParserOptions options,
13-
LIB_RUBY_PARSER_ByteList input);
12+
LIB_RUBY_PARSER_ByteList input,
13+
LIB_RUBY_PARSER_ParserOptions options);
1414

1515
#ifdef TEST_ENV
1616
void run_test_group_api(void);

benchmark/benchmark.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ int main()
3030
entry->content = NULL;
3131
entry->path = NULL;
3232

33-
LIB_RUBY_PARSER_ParserResult result = LIB_RUBY_PARSER_parse(options, input);
33+
LIB_RUBY_PARSER_ParserResult result = LIB_RUBY_PARSER_parse(input, options);
3434
LIB_RUBY_PARSER_drop_parser_result(&result);
3535
}
3636
clock_t end = clock();

ruby-parser-c/src/parser_result.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ pub extern "C" fn LIB_RUBY_PARSER_drop_parser_result(parser_result: *mut ParserR
8080

8181
#[no_mangle]
8282
pub extern "C" fn LIB_RUBY_PARSER_parse(
83-
options: ParserOptionsBlob,
8483
input: ByteListBlob,
84+
options: ParserOptionsBlob,
8585
) -> ParserResultBlob {
8686
let options: lib_ruby_parser::ParserOptions = CParserOptions::from(options).into();
8787
let input: Vec<u8> = input.into();

0 commit comments

Comments
 (0)