feat(xatu): report unquoted URI literals
This commit is contained in:
@@ -13,6 +13,11 @@ pub fn parse_file(file_id: FileId, source: &str) -> ast::ParsedFile {
|
||||
.descendants()
|
||||
.filter_map(convert_node)
|
||||
.collect(),
|
||||
tokens: parse
|
||||
.syntax()
|
||||
.descendants_with_tokens()
|
||||
.filter_map(convert_token)
|
||||
.collect(),
|
||||
errors: parse
|
||||
.errors()
|
||||
.iter()
|
||||
@@ -106,6 +111,21 @@ impl From<rnix::ast::Inherit> for ast::Inherit {
|
||||
}
|
||||
}
|
||||
|
||||
fn convert_token(element: rnix::SyntaxElement) -> Option<ast::Token> {
|
||||
let token = match element {
|
||||
rnix::NodeOrToken::Token(token) => token,
|
||||
rnix::NodeOrToken::Node(_) => return None,
|
||||
};
|
||||
|
||||
match token.kind() {
|
||||
rnix::SyntaxKind::TOKEN_URI => Some(ast::Token {
|
||||
range: token.text_range().into(),
|
||||
data: ast::TokenData::Uri(token.text().to_string()),
|
||||
}),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
fn convert_parse_error(error: &rnix::ParseError, source_len: usize) -> ast::ParseError {
|
||||
ast::ParseError {
|
||||
range: parse_error_range(error, source_len),
|
||||
|
||||
Reference in New Issue
Block a user