Skip to content

Instantly share code, notes, and snippets.

@deathbeam
Last active November 23, 2015 00:58
Show Gist options
  • Save deathbeam/f821fca6ca4a32cf3eed to your computer and use it in GitHub Desktop.
Save deathbeam/f821fca6ca4a32cf3eed to your computer and use it in GitHub Desktop.
Here is compiler output for same error in 4 different supported output formats for my new language

Below is error output of compiler trying to compile this file (as I lexed the multiline comment, but I do not consumed it in parser).



###
aaa
###

Switching between different error outputs is simple as passing --error json when running from command-line.

Simple

This is minimal error output usefull for building from CLI and not thinking about parsing the error:

test.spoon 5:1 - NoMatch TComment

JSON

{
  "error": {
    "type": "NoMatch",
    "message": "TComment",
    "position": {
      "source": "test.spoon",
      "line": 5,
      "collumn": 1
    }
  }
}

CSON

"error":
  "type": "NoMatch"
  "message": "TComment"
  "position":
    "source": "test.spoon"
    "line": 5
    "collumn": 1

YAML (default)

error:
  type: NoMatch
  message: TComment
  position:
    source: test.spoon
    line: 5
    collumn: 1

XML

<error>
  <type>NoMatch</type>
  <message>TComment</message>
  <position>
    <source>test.spoon</source>
    <line>5</line>
    <collumn>1</collumn>
  </position>
</error>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment