private void Factor(TokenParser parser)
        {
            if (_token == null)
            {
                return;
            }

            if (_token.TokenName == TokenParser.Tokens.LPAREN)
            {
                SkipWhiteSpace(parser);
                _token = parser.GetToken();
                SkipWhiteSpace(parser);
                Expression(parser);
                if (_token == null)
                {
                    return;
                }
                SkipWhiteSpace(parser);
                _token = parser.GetToken();
                SkipWhiteSpace(parser);
            }
            else if (_token.TokenName == TokenParser.Tokens.LABEL || TokenParser.GetNumericFunctionsList().Contains(_token.TokenName))
            {
                string name    = _token.TokenValue.ToUpper().Trim();
                bool   isArray = false;
                _hasLabel = true;

                switch (_token.TokenName)
                {
                case TokenParser.Tokens.LEN:
                    name = "LEN";
                    break;

                case TokenParser.Tokens.ASC:
                    name = "ASC";
                    break;

                case TokenParser.Tokens.RND:
                    name = "RND";
                    break;

                case TokenParser.Tokens.INSTR:
                    name = "INSTR";
                    break;
                }

                SkipWhiteSpace(parser);
                if (parser.Peek() != null && parser.Peek().TokenPeek != null &&
                    (parser.Peek().TokenPeek.TokenName == TokenParser.Tokens.LPAREN) || TokenParser.GetNumericFunctionsList().Contains(_token.TokenName))
                {
                    if (Variables.ContainsKey("varArray" + name) && Variables["varArray" + name].StartsWith("varArray" + name + " rmb "))
                    {
                        isArray = true;
                        int    paren = 1;
                        string exp   = "";

                        while (_token != null && paren >= 1)
                        {
                            var peek = parser.Peek();

                            if (peek != null && peek.TokenPeek != null && peek.TokenPeek.TokenValue != null)
                            {
                                if (peek.TokenPeek.TokenName == TokenParser.Tokens.LPAREN)
                                {
                                    paren++;
                                }
                                if (peek.TokenPeek.TokenName == TokenParser.Tokens.RPAREN)
                                {
                                    paren--;
                                    if (paren == 1)
                                    {
                                        SkipWhiteSpace(parser);
                                        parser.GetToken();
                                        SkipWhiteSpace(parser);
                                        exp    = exp + ")";
                                        _token = parser.GetToken();
                                        SkipWhiteSpace(parser);
                                        break;
                                    }
                                }
                                exp    = exp + peek.TokenPeek.TokenValue;
                                _token = parser.GetToken();
                            }
                            else
                            {
                                break;
                            }
                        }
                        var nc2 = new NumericExpressionParser {
                            Variables = Variables
                        };
                        nc2.Compile("(" + exp + ")", Output.StringCounter, Output.LoopCounter);

                        Output.StringCounter = nc2.Output.StringCounter;
                        Output.LoopCounter   = nc2.Output.LoopCounter;
                        Output.InitCode      = Output.InitCode + nc2.Output.InitCode;

                        foreach (KeyValuePair <string, string> kvp in nc2.Variables)
                        {
                            if (!Variables.ContainsKey(kvp.Key))
                            {
                                Variables.Add(kvp.Key, kvp.Value);
                            }
                        }

                        Output.Output = Output.Output + nc2.Output.Output;
                        Output.Output = Output.Output + " tfr x,d" + Environment.NewLine;
                        Output.Output = Output.Output + " tfr b,a" + Environment.NewLine;
                        Output.Output = Output.Output + " ldx #varArray" + name + Environment.NewLine;
                        Output.Output = Output.Output + " call ArrayIndexNumeric" + Environment.NewLine;
                        Output.Output = Output.Output + " ldb ,x+" + Environment.NewLine;
                        Output.Output = Output.Output + " lda ,x" + Environment.NewLine;
                        Output.Output = Output.Output + " tfr d,x" + Environment.NewLine;
                    }
                }
                if (!isArray && !TokenParser.GetNumericFunctionsList().Contains(_token.TokenName))
                {
                    _token = parser.GetToken();
                }
                SkipWhiteSpace(parser);

                if (_token != null && (_token.TokenName == TokenParser.Tokens.LPAREN || TokenParser.GetNumericFunctionsList().Contains(_token.TokenName)))
                {
                    if (_token.TokenName == TokenParser.Tokens.INSTR)
                    {
                        DoInstr(parser);

                        SkipWhiteSpace(parser);
                        _token = parser.GetToken();
                        return;
                    }
                    int    paren = 1;
                    string exp   = "";

                    while (_token != null && paren > 0)
                    {
                        var peek = parser.Peek();
                        if (peek != null && peek.TokenPeek != null && peek.TokenPeek.TokenValue != null)
                        {
                            if (peek.TokenPeek.TokenName == TokenParser.Tokens.LPAREN)
                            {
                                paren++;
                            }
                            if (peek.TokenPeek.TokenName == TokenParser.Tokens.RPAREN)
                            {
                                paren--;
                                if (paren == 0)
                                {
                                    _token = parser.GetToken();
                                    break;
                                }
                            }
                            exp    = exp + peek.TokenPeek.TokenValue;
                            _token = parser.GetToken();
                        }
                        else
                        {
                            break;
                        }
                    }
                    IExpressionParser eParser = BooleanExpressionParser.IsString(exp)
                        ? (IExpressionParser) new StringExpressionParser()
                        : new NumericExpressionParser();

                    eParser.Variables = Variables;
                    eParser.Compile(exp, Output.StringCounter, Output.LoopCounter);

                    Output.StringCounter = eParser.Output.StringCounter;
                    Output.LoopCounter   = eParser.Output.LoopCounter;
                    Output.InitCode      = Output.InitCode + eParser.Output.InitCode;

                    foreach (KeyValuePair <string, string> kvp in eParser.Variables)
                    {
                        if (!Variables.ContainsKey(kvp.Key))
                        {
                            Variables.Add(kvp.Key, kvp.Value);
                        }
                    }

                    //Output.Output = Output.Output + " push y" + Environment.NewLine;
                    //if (BooleanExpressionParser.IsString(exp))
                    //    Output.Output = Output.Output + " ldy #TheBasicStrBuf" + Environment.NewLine;
                    //Output.Output = Output.Output + eParser.Output.Output;
                    //if (BooleanExpressionParser.IsString(exp))
                    //    Output.Output = Output.Output + " ldx #TheBasicStrBuf" + Environment.NewLine;
                    //if (name.Trim().ToUpper() == "INPUT")
                    //    Output.Output = Output.Output + " call func" + name + "2" + Environment.NewLine;
                    //else Output.Output = Output.Output + " call func" + name + Environment.NewLine;
                    //Output.Output = Output.Output + " pop y" + Environment.NewLine;

                    Output.Output = Output.Output + eParser.Output.Output;
                    if (BooleanExpressionParser.IsString(exp))
                    {
                        Output.Output = Output.Output + " push y" + Environment.NewLine;
                        Output.Output = Output.Output + " push x" + Environment.NewLine;
                        Output.Output = Output.Output + " call func" + name + Environment.NewLine;
                        Output.Output = Output.Output + " tfr x,y" + Environment.NewLine;
                        Output.Output = Output.Output + " pop x" + Environment.NewLine;
                        Output.Output = Output.Output + " call freememory" + Environment.NewLine;
                        Output.Output = Output.Output + " tfr y,x" + Environment.NewLine;
                        Output.Output = Output.Output + " pop y" + Environment.NewLine;
                    }
                    else
                    {
                        Output.Output = Output.Output + " call func" + name + Environment.NewLine;
                    }

                    SkipWhiteSpace(parser);
                    _token = parser.GetToken();
                    SkipWhiteSpace(parser);
                }
                else
                {
                    if (!isArray)
                    {
                        Output.Output = Output.Output + " ldx var" + name + Environment.NewLine;
                    }
                    AddVariable("var" + name);
                }
            }
            else
            {
                if (_token.TokenName == TokenParser.Tokens.HEXNUMBER)
                {
                    Output.Output = Output.Output + " ldx #$" + _token.TokenValue.Replace("&h", "").Replace("&H", "") + Environment.NewLine;
                }
                else
                {
                    Output.Output = Output.Output + " ldx #" + _token.TokenValue + Environment.NewLine;
                }
                SkipWhiteSpace(parser);
                _token = parser.GetToken();
                SkipWhiteSpace(parser);
            }
        }