[dingus] Color syntax nodes red when they are errors

This commit is contained in:
John Doty 2024-10-06 08:06:54 -07:00
parent 1a8c768772
commit 15a7feac07
2 changed files with 8 additions and 2 deletions

View file

@ -72,8 +72,6 @@ let grammar_editor = null;
let input_editor = null;
function render_parse_results(message) {
console.log("WHAT?");
function render_tree_node(parent, node) {
const tree_div = document.createElement("div");
tree_div.classList.add("parsed-node");
@ -89,8 +87,12 @@ function render_parse_results(message) {
{scroll: true},
);
};
if (node.start == node.end) {
node_label.classList.add("parsed-error-node");
}
tree_div.appendChild(node_label);
if (node.kind === "tree") {
tree_div.classList.add("parsed-tree");
for (const child of node.children) {

View file

@ -57,6 +57,10 @@ body {
margin-left: 1rem;
}
.parsed-error-node {
color: red;
}
.main-textarea {
height: 100%;
width: 100%;