def is_funcdef?
      buf = []
      r = false
      while true
        tok = get
        buf.push(tok)

        # Early return
        raise "premature end of input" if tok.kind == T::EOF
        if Token.is_keyword?(tok, ';')
          break
        end
        if is_type?(tok)
          next
        end
        if Token.is_keyword?(tok, '(')
          skip_parentheses!(buf)
          next
        end

        # Check if function definition
        if tok.kind != T::IDENT
          next
        end
        if !Token.is_keyword?(peek, '(')
          next
        end
        buf.push(get)
        skip_parentheses!(buf)

        # (Usually '{' comes after a closing parenthesis.
        # A type keyword is allowed for K&R-style function definitions.
        r = (Token.is_keyword?(peek, '{') || is_type?(peek))
        break
      end

      while buf.size > 0
        @lexer.unget_token(buf.pop)
      end
      r
    end
def is_funcdef?
      buf = []
      r = false
      while true
        tok = get
        buf.push(tok)

        # Early return
        raise "premature end of input" if tok.kind == T::EOF
        if Token.is_keyword?(tok, ';')
          break
        end
        if is_type?(tok)
          next
        end
        if Token.is_keyword?(tok, '(')
          skip_parentheses!(buf)
          next
        end

        # Check if function definition
        if tok.kind != T::IDENT
          next
        end
        if !Token.is_keyword?(peek, '(')
          next
        end
        buf.push(get)
        skip_parentheses!(buf)

        # (Usually '{' comes after a closing parenthesis.
        # A type keyword is allowed for K&R-style function definitions.
        r = (Token.is_keyword?(peek, '{') || is_type?(peek))
        break
      end

      while buf.size > 0
        @lexer.unget_token(buf.pop)
      end
      r
    end
TODO(south37) Improve performance by cache.
 is_funcdef? returns true if we are at beginning of a function definition.
 The basic idea is that if we see '{' or a type keyword after a closing
 parenthesis of a function parameter list, we were reading a function
 definition. (Usually '{' comes after a closing parenthesis.
 A type keyword is allowed for K&R-style function definitions.)