 # Tokens have type and value
 class Token
   constructor: (@type, @value) ->
+    if @type == "COEFFICIENT" and @value == "-"
+      @value = "-1"
 
   toString: -> "[#{@type} '#{@value}']"
 


# Test the parser
inequation = good[1]
console.log "\nParsing: #{inequation}\n"

tokens = lex inequation
console.log "Tokens: #{tokens}"

normalised = normalise_minus_coefficients tokens
console.log "Normalised minus: #{normalised}"

normalised = normalise_coefficients normalised
console.log "Normalised coefficients: #{normalised}"

parsed = parse normalised
console.log "Parsed: #{parsed}"

console.log parse normalise_coefficients normalise_minus_coefficients tokens

      return lex consume(input, result), tokens.concat(token)

  throw "Parse error at '#{input}' (tokens: #{tokens}, last token: #{previous})"

# Replace all subtract operators with adds, normalising the coefficeints
normalise_coefficients = (tokens, normalised=[]) ->
