mirror of
https://github.com/edg-l/edlang.git
synced 2024-11-22 16:08:24 +00:00
format
This commit is contained in:
parent
c68daa2d93
commit
7e88b8fb12
44
src/check.rs
44
src/check.rs
|
@ -33,13 +33,11 @@ pub fn check<'a>(data: &'a ProgramData, ast: &ast::Program) -> Vec<Check<'a>> {
|
||||||
line_start: 1,
|
line_start: 1,
|
||||||
fold: true,
|
fold: true,
|
||||||
origin: Some(&data.filename),
|
origin: Some(&data.filename),
|
||||||
annotations: vec![
|
annotations: vec![SourceAnnotation {
|
||||||
SourceAnnotation {
|
label: "unexpected statement",
|
||||||
label: "unexpected statement",
|
annotation_type: AnnotationType::Error,
|
||||||
annotation_type: AnnotationType::Error,
|
range: statement.span.into(),
|
||||||
range: statement.span.into(),
|
}],
|
||||||
},
|
|
||||||
],
|
|
||||||
}],
|
}],
|
||||||
opt: FormatOptions {
|
opt: FormatOptions {
|
||||||
color: true,
|
color: true,
|
||||||
|
@ -51,8 +49,8 @@ pub fn check<'a>(data: &'a ProgramData, ast: &ast::Program) -> Vec<Check<'a>> {
|
||||||
errors.push(Check::Error(dl));
|
errors.push(Check::Error(dl));
|
||||||
}
|
}
|
||||||
Statement::Definition(_) => {
|
Statement::Definition(_) => {
|
||||||
// can't have a top level assignment yet.
|
// can't have a top level assignment yet.
|
||||||
let snippet = Snippet {
|
let snippet = Snippet {
|
||||||
title: Some(Annotation {
|
title: Some(Annotation {
|
||||||
id: None,
|
id: None,
|
||||||
label: Some("unexpected definition at top level"),
|
label: Some("unexpected definition at top level"),
|
||||||
|
@ -64,13 +62,11 @@ pub fn check<'a>(data: &'a ProgramData, ast: &ast::Program) -> Vec<Check<'a>> {
|
||||||
line_start: 1,
|
line_start: 1,
|
||||||
fold: true,
|
fold: true,
|
||||||
origin: Some(&data.filename),
|
origin: Some(&data.filename),
|
||||||
annotations: vec![
|
annotations: vec![SourceAnnotation {
|
||||||
SourceAnnotation {
|
label: "unexpected statement",
|
||||||
label: "unexpected statement",
|
annotation_type: AnnotationType::Error,
|
||||||
annotation_type: AnnotationType::Error,
|
range: statement.span.into(),
|
||||||
range: statement.span.into(),
|
}],
|
||||||
},
|
|
||||||
],
|
|
||||||
}],
|
}],
|
||||||
opt: FormatOptions {
|
opt: FormatOptions {
|
||||||
color: true,
|
color: true,
|
||||||
|
@ -80,7 +76,7 @@ pub fn check<'a>(data: &'a ProgramData, ast: &ast::Program) -> Vec<Check<'a>> {
|
||||||
|
|
||||||
let dl = DisplayList::from(snippet);
|
let dl = DisplayList::from(snippet);
|
||||||
errors.push(Check::Error(dl));
|
errors.push(Check::Error(dl));
|
||||||
},
|
}
|
||||||
Statement::Return(_x) => {
|
Statement::Return(_x) => {
|
||||||
// can't have a top level assignment yet.
|
// can't have a top level assignment yet.
|
||||||
let snippet = Snippet {
|
let snippet = Snippet {
|
||||||
|
@ -95,13 +91,11 @@ pub fn check<'a>(data: &'a ProgramData, ast: &ast::Program) -> Vec<Check<'a>> {
|
||||||
line_start: 1,
|
line_start: 1,
|
||||||
fold: true,
|
fold: true,
|
||||||
origin: Some(&data.filename),
|
origin: Some(&data.filename),
|
||||||
annotations: vec![
|
annotations: vec![SourceAnnotation {
|
||||||
SourceAnnotation {
|
label: "unexpected return",
|
||||||
label: "unexpected return",
|
annotation_type: AnnotationType::Error,
|
||||||
annotation_type: AnnotationType::Error,
|
range: statement.span.into(),
|
||||||
range: statement.span.into(),
|
}],
|
||||||
},
|
|
||||||
],
|
|
||||||
}],
|
}],
|
||||||
opt: FormatOptions {
|
opt: FormatOptions {
|
||||||
color: true,
|
color: true,
|
||||||
|
@ -111,7 +105,7 @@ pub fn check<'a>(data: &'a ProgramData, ast: &ast::Program) -> Vec<Check<'a>> {
|
||||||
|
|
||||||
let dl = DisplayList::from(snippet);
|
let dl = DisplayList::from(snippet);
|
||||||
errors.push(Check::Error(dl));
|
errors.push(Check::Error(dl));
|
||||||
},
|
}
|
||||||
Statement::Function(_function) => {}
|
Statement::Function(_function) => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue