Skip to content

Commit

Permalink
fix: remove unknown syntax error
Browse files Browse the repository at this point in the history
  • Loading branch information
felixrieg committed Oct 10, 2023
1 parent 28a99f4 commit 4b44b65
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions uvls/src/core/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,35 @@ pub fn classify_error(root: Node, source: &Rope) -> ErrorInfo {
};
}
}
if Regex::new(r"^\d+")
.unwrap()
.is_match(err_source.as_str().unwrap_or(""))
{
let name = source
.get_line(root.start_position().row)
.unwrap()
.as_str()
.unwrap()
.trim()
.replace("\n", "");

return ErrorInfo {
location: Range {
start: Position {
line: root.start_position().row as u32,
character: root.start_position().column as u32,
},
end: Position {
line: root.start_position().row as u32,
character: root.start_position().column as u32 + name.len() as u32,
},
},
severity: DiagnosticSeverity::ERROR,
weight: 100,
msg: "features are not allowed to start with a number".into(),
error_type: ErrorType::StartsWithNumber,
};
}
ErrorInfo {
location: node_range(root, source),
severity: DiagnosticSeverity::ERROR,
Expand Down

0 comments on commit 4b44b65

Please sign in to comment.