git.delta.rocks / jrsonnet / refs/commits / c02b270b3da5

difftreelog

source

crates/jrsonnet-rowan-parser/src/lex.rs450 Bsourcehistory
1use jrsonnet_lexer::Lexer;2use rowan::{TextRange, TextSize};34use crate::SyntaxKind;56#[derive(Clone, Copy, Debug)]7pub struct Lexeme<'s> {8	pub kind: SyntaxKind,9	pub text: &'s str,10	pub range: TextRange,11}1213pub fn lex(input: &str) -> Vec<Lexeme<'_>> {14	Lexer::new(input).map(|l| Lexeme {15		kind: SyntaxKind::from_raw(l.kind.into_raw()),16		text: l.text,17		range: TextRange::new(TextSize::from(l.range.0), TextSize::from(l.range.1)),18	}).collect()19}