   catch result
     result = "<div class=\"error\">" + result + "</div>"
   return result.replace /\n/g,''
-
-

          input.substr(lookahead.from) + "'"  
  tree

      
      
      
      
      
      
#Implementado para los test
root = exports ? this
root.test_main = (text) ->
  source = text


  factor = ->
    result = null

    if lookahead.type is "NUM"
      result =
        type: "NUM"
        value: lookahead.value
      match "NUM"

    else if lookahead.type is "ID"
      result =
        type: "ID"
        value: lookahead.value
      match "ID"

    else if lookahead.type is "("
      match "("
      result = expression()
      match ")"

    else
      throw "Syntax Error. Expected number or identifier or '(' but found " + 
            (if lookahead then lookahead.value else "end of input") + 
            " near '" + input.substr(lookahead.from) + "'"
