Fix syntax highlighting for new import patterns

This commit is contained in:
Jakub Žádník 2021-10-27 00:30:39 +03:00
parent bd6c550470
commit 78256b4923

View File

@ -492,9 +492,15 @@ pub fn parse_use(
let bytes = working_set.get_span_contents(spans[0]);
if bytes == b"use" && spans.len() >= 2 {
let (module_name_expr, err) = parse_string(working_set, spans[1]);
let mut import_pattern_exprs: Vec<Expression> = vec![];
for span in spans[1..].iter() {
let (expr, err) = parse_string(working_set, *span);
import_pattern_exprs.push(expr);
error = error.or(err);
}
// TODO: Add checking for importing too long import patterns, e.g.:
// > use spam foo non existent names here do not throw error
let (import_pattern, err) = parse_import_pattern(working_set, &spans[1..]);
error = error.or(err);
@ -598,7 +604,7 @@ pub fn parse_use(
let call = Box::new(Call {
head: spans[0],
decl_id: use_decl_id,
positional: vec![module_name_expr],
positional: import_pattern_exprs,
named: vec![],
});