Skip to content

Commit

Permalink
🎨 Add ascii art on errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ChmielewskiKamil committed Sep 7, 2024
1 parent cd13e16 commit 31e3f5d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions repl/repl.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ import (

const PROMPT = ">> "
const FN_BOILERPLATE = "function repl() public { "
const ASCII_ART = `
| ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄|
| You fucked up, try again... |
|_________________|
\ (•◡•) /
\ /
————
| |
|_ |_`

// @TODO: After introducing the file handle, the REPL does not work.
func Start(in io.Reader, out io.Writer) {
Expand All @@ -30,6 +39,8 @@ func Start(in io.Reader, out io.Writer) {

file := p.ParseFile()
if len(p.Errors()) > 0 {
io.WriteString(out, ASCII_ART)
io.WriteString(out, "\n")
for _, err := range p.Errors() {
io.WriteString(out, "\t"+err.Msg+"\n")
}
Expand Down

0 comments on commit 31e3f5d

Please sign in to comment.