   findExpressionNodeClass: (tokens) ->
     return ExpressionNode  # TODO!
 
-
+  nextToken: (tokens) ->
+    while tokens.length > 0 and (tokens[0].type == @language.tokenType.EOL or tokens[0].type == @language.tokenType.EOF)
+      tokens = tokens[1..]
+    return if tokens.length > 0 then tokens[0] else @language.tokenType.EOF
 
   class TreeNode
     constructor: (@parent = undefined)->

          return new ParseError(type = 'Syntax Error', message = 'Expected END')

  class ThenNode extends BlockNode
    build: (tokens) ->

      # Consume THEN token
      @tokens.push(tokens[0])
      tokens = tokens[1..]

      # Build statements
      return super(tokens, endNodes = [ElseIfNode, ElseNode, EndNode])

  class ElseIfNode extends TreeNode

  class ElseNode extends BlockNode
    build: (tokens) ->

      # Consume ELSE token
      @tokens.push(tokens[0])
      tokens = tokens[1..]

      # Build statements
      return super(tokens, endNodes = [ElseIfNode, ElseNode, EndNode])

  class EndNode extends TreeNode


        else if node instanceof ElseNode
          @elseNode = node

          # Check singleline IF THEN ELSE
          if @thenNode.singleline and @elseNode.singleline and self.nextToken(tokens).type not in [self.language.tokenType.Else, self.language.tokenType.End]
            return tokens

        # END node
        else if node instanceof EndNode
          return tokens
