Exemplo n.º 1
0
 public override List<Token> Tokenize()
 {
     var returnList = new List<Token>();
     for (TokenListNode node = list.First; node != null; node = node.Next)
     {
         returnList.AddRange(((Value) node.Value).Tokenize());
     }
     return returnList;
 }
Exemplo n.º 2
0
        public override List<Token> Tokenize()
        {
            var rpn = new List<Token>();
            if ( op is DotOperator ) //Special case for the dot operator which needs to be arranged like a sufix unary
            {
                if ( first is Expression || first is ExpressionSequence ) rpn.AddRange( first.Tokenize() );
                else rpn.Add( first );
                rpn.Add( op );
                if ( second is Expression || second is ExpressionSequence ) rpn.AddRange( second.Tokenize() );
                else if ( !( second is NoValue ) ) rpn.Add( second );
            } else
            {
                if ( first is Expression || first is ExpressionSequence ) rpn.AddRange( first.Tokenize() );
                else rpn.Add( first );
                if ( second is Expression || second is ExpressionSequence ) rpn.AddRange( second.Tokenize() );
                else if ( !( second is NoValue ) ) rpn.Add( second );
                rpn.Add( op );
            }

            return rpn;
        }