Esempio n. 1
0
 public PreOpReference(PreOpDeclaration op, Expression oper, SourcePosition start, SourcePosition end)
     : base(ASTNodeType.InOpRef, start, end)
 {
     Operator = op;
     Operand  = oper;
 }
Esempio n. 2
0
        public Expression DecompileNativeFunction(UInt16 index)
        {
            var parameters = new List<Expression>();
            while (!CurrentIs(StandardByteCodes.EndFunctionParms))
            {
                var param = DecompileExpression();
                if (param == null)
                    return null; // ERROR

                parameters.Add(param);
            }
            PopByte();

            var entry = NativeTable[index];
            Expression call = null;

            switch (entry.Type)
            {
                case NativeType.Function:
                    var func = new SymbolReference(null, null, null, entry.Name);
                    call = new FunctionCall(func, parameters, null, null);
                    break;

                case NativeType.Operator:   // TODO: table should hold precedence, currently all have 0 and it'll be a mess.
                    var op = new InOpDeclaration(entry.Name, entry.Precedence, false, null, null, null, null, null, null, null);
                    call = new InOpReference(op, parameters[0], parameters[1], null, null);
                    break;

                case NativeType.PreOperator:   // TODO: table should hold precedence, currently all have 0 and it'll be a mess.
                    var preOp = new PreOpDeclaration(entry.Name, false, null, null, null, null, null, null);
                    call = new PreOpReference(preOp, parameters[0], null, null);
                    break;

                case NativeType.PostOperator:   // TODO: table should hold precedence, currently all have 0 and it'll be a mess.
                    var postOp = new PostOpDeclaration(entry.Name, false, null, null, null, null, null, null);
                    call = new PostOpReference(postOp, parameters[0], null, null);
                    break;
            }

            StartPositions.Pop();
            return call;
        }
Esempio n. 3
0
 public bool IdenticalSignature(PreOpDeclaration other)
 {
     return base.IdenticalSignature(other)
         && this.Operand.VarType.Name.ToLower() == other.Operand.VarType.Name.ToLower();
 }
Esempio n. 4
0
 public PreOpReference(PreOpDeclaration op, Expression oper, SourcePosition start, SourcePosition end)
     : base(ASTNodeType.InOpRef, start, end)
 {
     Operator = op;
     Operand = oper;
 }
Esempio n. 5
0
 public bool IdenticalSignature(PreOpDeclaration other)
 {
     return(base.IdenticalSignature(other) &&
            this.Operand.VarType.Name.ToLower() == other.Operand.VarType.Name.ToLower());
 }
Esempio n. 6
0
 public bool IdenticalSignature(PreOpDeclaration other)
 {
     return(base.IdenticalSignature(other) &&
            string.Equals(this.Operand.VarType.Name, other.Operand.VarType.Name, StringComparison.Ordinal));
 }