Results of SyntaxCheck -> extra State

This commit is contained in:
Simon Martens
2023-09-10 16:34:49 +02:00
parent 8fd0050cf3
commit 80e593ce7c
16 changed files with 122 additions and 102 deletions

View File

@@ -1,22 +1,22 @@
namespace HaWeb.Models;
public class SyntaxCheckModel {
public string Prefix { get; private set; }
public List<SyntaxError>? Errors { get; set; }
public List<SyntaxError>? Warnings { get; set; }
public string File { get; private set; }
public List<SyntaxError>? Errors { get; private set; }
public SyntaxCheckModel(string prefix) {
Prefix = prefix;
public SyntaxCheckModel(string file) {
File = file;
}
public void Log(int? line, int? column, string msg) {
if (String.IsNullOrWhiteSpace(msg)) return;
if (Errors == null) Errors = new();
// var prefix = DateTime.Now.ToLongDateString() + ": ";
Errors.Add(new SyntaxError(line, column, msg));
}
public void ResetLog() {
Errors = null;
}
}
public class SyntaxError {
public string Message { get; private set; }
public string? File { get; set; }
public string? Line { get; set; }
public string? Column { get; set; }
public SyntaxError(string message) {
Message = message;
}
}