moonscript icon indicating copy to clipboard operation
moonscript copied to clipboard

Parsing failure... ?

Open TangentFoxy opened this issue 8 years ago • 1 comments

running = {}

Node = (tab) ->
  state, started = {}, false
  return (object) ->
    local result
    unless started
  ‎    result = tab.start object, state if tab.start
  ‎    started = true unless result == false
  ‎  result = tab.run object, state unless result == false
  ‎  if result != running
  ‎    started = false
  ‎    result = tab.finish object, state if result and tab.finish
  ‎  return result

Fails to parse on line 7, and I don't believe there is an error in my syntax...

Failed to parse:
[7] >> unless started

TangentFoxy avatar Mar 16 '18 01:03 TangentFoxy

I think you have some kind of Unicode character, probably a nowidth, stuck in there. Perhaps a prank by some colleagues? Anyways, I rewrote it:

running = {}
Node = (tab) ->
  state, started = {}, false
  return (object)->
    local result
    unless started
      result = tab.start object, state if tab.start
      started = true unless result == false
    result = tab.run object, state unless result == false
    if result != running
      started = false
      result = tab.finish object, state if result and tab.finish
    return result

RyanSquared avatar Mar 16 '18 03:03 RyanSquared