public static void ParseParametersList(Parser.State state, FunctionNode function)
        {
            while (!state.GetToken().Is(TokenSubType.BraceRoundRight, ")"))
            {
                if (state.GetToken().Type != TokenType.Identifier)
                {
                    state.ErrorCode    = (uint)ErrorCodes.P_IdentifierExpected;
                    state.ErrorMessage =
                        $"Expected parameter name(<identifier>) " +
                        $"but <{state.GetToken().SubType}>({state.GetToken().Value}) " +
                        $"were given";
                    return;
                }

                var parameterName = state.GetTokenAndMoveNE().Value;

                if (!state.GetToken().Is(TokenSubType.Colon, ":"))
                {
                    state.ErrorCode    = (uint)ErrorCodes.P_ColonBeforeTypeSpeceficationNotFound;
                    state.ErrorMessage =
                        $"Expected <Colon>(:) before parameter type specification " +
                        $"but <{state.GetToken().SubType}>({state.GetToken().Value}) were given";
                    return;
                }
                state.GetNextNEToken();

                var parameterType = TypeParser.Parse(state);

                function.Parameters.Add(new VariableNode
                {
                    Name = parameterName,
                    Type = parameterType
                });

                if (state.GetToken().SubType == TokenSubType.Comma)
                {
                    state.GetNextNEToken();
                }
            }

            state.GetNextNEToken();
        }
        private static bool ParseFunctionDeclaration(Parser.State state, CoreNode coreNode)
        {
            state.Save();

            if (state.GetToken().Type != TokenType.Identifier)
            {
                state.Restore();
                return(false);
            }

            string name = state.GetTokenAndMoveNE().Value;

            if (!state.GetToken().Is(TokenSubType.Colon, ":"))
            {
                state.ErrorCode    = (uint)ErrorCodes.P_ColonBeforeTypeSpeceficationNotFound;
                state.ErrorMessage =
                    $"Expected <Colon>(:) before function type specification " +
                    $"but <{state.GetToken().SubType}>({state.GetToken().Value}) were given";
                return(false);
            }
            state.GetNextNEToken();

            TypeNode type = TypeParser.Parse(state);

            if (state.IsErrorOccured())
            {
                return(false);
            }

            /*
             * // Only for class methods
             * bool isInstance = state.GetToken().Is(TokenSubType.Dot, ".");
             * bool isStatic = state.GetToken().Is(TokenSubType.Colon, ":");
             *
             * if (!(isStatic || isInstance))
             * {
             *  state.ErrorCode = (uint)ErrorCodes.P_MethodTypeExpected;
             *  state.ErrorMessage =
             *      $"Expected '.' or ':' as type modifier, but " +
             *      $"<{state.GetToken().SubType.ToString()}> were found";
             *  return false;
             * }
             */

            FunctionNode function = new FunctionNode
            {
                Parent = coreNode,
                Name   = name,
                Type   = FunctionNode.EType.Static,

                ReturnType = type
            };

            coreNode.FunctionNodes.Add(function);

            if (!state.GetToken().Is(TokenSubType.BraceRoundLeft, "("))
            {
                state.ErrorCode    = (uint)ErrorCodes.P_OpeningBracketExpected;
                state.ErrorMessage =
                    $"Opening round bracket is expected before parameters list " +
                    $"but <{state.GetToken().SubType}> were given";

                return(false);
            }

            state.GetNextNEToken();
            FunctionParser.ParseParametersList(state, function);
            if (state.IsErrorOccured())
            {
                return(true);
            }

            // FunctionParser.ParseTemplateValues(state, function);
            function.Code = CodeParser.Parse(state);
            return(!state.IsErrorOccured());
        }