public void Encode(ASTLiteral node)
 {
     m_stack.Push(m_senselessExpr);
 }
        //<Dim Factor> ::= '<' <Magnitude> '>'
        //             |    Identifier        ! Unit name (e.g. Meter)
        //             |    <Num Literal>
        //             |   '(' <Dim Term> ')'
        //
        // <Num Literal> ::= IntLiteral | RealLiteral | StringLiteral  ! Member-access (e.g. "Math.PI")
        private ASTNode GetDimFactor(UnitType candidate, NumericType numType)
        {
            // '<' Magnitude '>'?
            if (m_symbol == Lexer.Symbol.LT)
            {
                GetToken();
                return(GetDimMagnitude(candidate));
            }

            // '(' <Dim Term> ')'?
            else if (m_symbol == Lexer.Symbol.Lparen)
            {
                GetToken();
                ASTNode factor = GetDimTerm(candidate, numType);
                if (factor != null)
                {
                    if (m_symbol != Lexer.Symbol.Rparen)
                    {
                        Note("{0}: \"{1}\" found while expected closing parenthesis \")\".", candidate.Name, m_token);
                    }
                    else
                    {
                        GetToken();
                        return(new ASTParenthesized(factor));
                    }
                }
            }

            // <Num Literal>?
            else if ((m_symbol == Lexer.Symbol.IntNumber) || (m_symbol == Lexer.Symbol.RealNumber))
            {
                Number number = numType.TryParse(m_token);
                if (number == null)
                {
                    Note("{0}: invalid number \"{1}\".", candidate.Name, m_token);
                }
                else
                {
                    GetToken();
                    return(new ASTNumber(number));
                }
            }

            // <String Literal> e.g. "Math.PI"?
            else if (m_symbol == Lexer.Symbol.StringLiteral)
            {
                ASTNode factor = new ASTLiteral(m_token);
                GetToken();
                return(factor);
            }

            // Unit identifier?
            else if (m_symbol == Lexer.Symbol.Identifier)
            {
                UnitType u = FindUnit(m_token);
                if (u == null)
                {
                    Note("{0}: undefined unit \"{1}\".", candidate.Name, m_token);
                }
                else if (u.Factor.Value.Type != numType)
                {
                    Note("{0}: unit \"{1}\" is of type <{2}> != <{3}>.", candidate.Name, m_token, u.Factor.Value.Type.Name, numType.Name);
                }
                else
                {
                    GetToken();
                    return(new ASTUnit(u));
                }
            }

            else
            {
                Note("{0}: \"{1}\" found while expected: <dimension> | unit | number | \"literal\" | (expression).", candidate.Name, m_token);
            }

            return(null);
        }
 public void Encode(ASTLiteral node)
 {
     m_stack.Push(new NumExpr(false, m_numtype.One, node.Literal));  // NOTE: it takes 1.0 (one) as a fake (untrue) value of the Literal
 }