const fs = require("fs");
const path = require("path");
const {assert} = require("chai");
const parser = require("../src/compiler/parser");

const testFile = fs.readFileSync(path.join(__dirname, "fixtures/TodoList.piece"), {encoding: "utf8"});

describe("parse", () => {
  it("parses", () => {
    try {
      const parsed = parser.parse(testFile);
      console.log(JSON.stringify(parsed, null, 2));
      assert(typeof parsed === "object");
    } catch (e) {
      if (e instanceof parser.SyntaxError) {
        throw new Error(`Syntax error at ${e.line}:${e.column}: ${e.message}`);
      } else {
        throw e;
      }
    }
  });
});

@@ -495,24 +495,73 @@
 taxError) %7B%0A
+        const %7Bline, column%7D = e.location.start;%0A
         thro
@@ -595,18 +595,16 @@
 t $%7B
-e.
 line%7D:$%7B
 e.co
@@ -599,18 +599,16 @@
 line%7D:$%7B
-e.
 column%7D:

Update test