Skip to content

Commit

Permalink
fix(benchmark): fix usage with cargo run
Browse files Browse the repository at this point in the history
  • Loading branch information
ObserverOfTime committed Oct 21, 2024
1 parent be81c59 commit 9a23c1a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions bindings/rust/benchmark.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
use std::env::args;

use tree_sitter::{InputEdit, Point};
use tree_sitter_md::{MarkdownParser, MarkdownTree};

fn main() {
let mut parser = MarkdownParser::default();
let filename = std::env::args().nth(1).unwrap_or("README.md".to_string());
let filename = args()
.nth_back(1)
.take_if(|f| f != "benchmark")
.unwrap_or("README.md".to_string());
let source = std::fs::read(filename).unwrap();

let mut parser = MarkdownParser::default();
let mut tree = parser.parse(&source, None).unwrap();
tree.edit(&InputEdit {
start_byte: 0,
Expand Down

0 comments on commit 9a23c1a

Please sign in to comment.