FIxing the README in highlight
* 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
@@ -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");
},
}
}
