From acc5f092c81e4b53f4af07cbbf3e2be027fb3e7e Mon Sep 17 00:00:00 2001 From: Han BAO Date: Fri, 6 Dec 2019 15:05:28 -0600 Subject: [PATCH] FIxing the README in highlight (#501) * Correct README.md in /highlight correct the lifetime in highlighter.highlight and correct the cases in match so that the demo in README could work. * Update README.md another small fix * Update highlight/README.md Co-Authored-By: Max Brunsfeld --- highlight/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/highlight/README.md b/highlight/README.md index e4961fb8..1544f09a 100644 --- a/highlight/README.md +++ b/highlight/README.md @@ -80,22 +80,22 @@ Highlight some code: use tree_sitter_highlight::HighlightEvent; let highlights = highlighter.highlight( - javascript_config, + &javascript_config, b"const x = new Y();", None, - &|_| None + |_| None ).unwrap(); for event in highlights { match event? { - HighlightEvent::Source(s) { - eprintln!("source: {:?}", s); + HighlightEvent::Source {start, end} => { + eprintln!("source: {}-{}", start, end); }, HighlightEvent::HighlightStart(s) { eprintln!("highlight style started: {:?}", s); }, - HighlightEvent::HighlightEnd(s) { - eprintln!("highlight style ended: {:?}", s); + HighlightEvent::HighlightEnd { + eprintln!("highlight style ended"); }, } }