diff --git a/js/.gitignore b/js/.gitignore index 22e6580..34977ee 100644 --- a/js/.gitignore +++ b/js/.gitignore @@ -1,2 +1,2 @@ -node_modules +node_modules .idea \ No newline at end of file diff --git a/js/fizzbuzz.bf b/js/fizzbuzz.bf index e4c514e..dd46222 100644 --- a/js/fizzbuzz.bf +++ b/js/fizzbuzz.bf @@ -1,2 +1 @@ - - ++[-]. \ No newline at end of file +hello...[[].]] diff --git a/js/src/index.js b/js/src/index.js index 81672ba..5e89184 100644 --- a/js/src/index.js +++ b/js/src/index.js @@ -1,5 +1,8 @@ import fs from 'fs/promises'; +const RED = '\x1B[1;31m'; +const RESET = '\x1B[1;0m'; + function lex(string) { const tokens = []; @@ -83,9 +86,9 @@ function reportError(source, message, span) { const linePrefix = `${lineNumber} | `; const lineSpan = span - lastNewlineIdx; - console.error(`error: ${message}`); + console.error(`${RED}error: ${message}${RESET}`); console.error(`${linePrefix}${line}`); - console.error(`${' '.repeat(linePrefix.length)}${'-'.repeat(lineSpan)}^`); + console.error(`${' '.repeat(linePrefix.length + lineSpan)}${RED}^${RESET}`); } const file = process.argv[2];