Exemplo n.º 1
0
        internal Function DeclareFunction(PigeonType returnType, string name, Variable[] parameters, object funcBody)
        {
            var function = new Function(returnType, name, parameters, funcBody);

            functions.Add(function.Name, function);
            return(function);
        }
Exemplo n.º 2
0
 public void RegisterVariable(PigeonType type, string name, bool readOnly, object value)
 {
     variables.Add(name, new Variable(type, name, readOnly)
     {
         Value = value
     });
 }
Exemplo n.º 3
0
        internal Variable DeclareVariable(PigeonType type, string name, bool readOnly = false, object value = null)
        {
            var variable = new Variable(type, name, readOnly)
            {
                Value = value
            };

            variables.Add(variable.Name, variable);
            return(variable);
        }
Exemplo n.º 4
0
 public void RegisterFunction(PigeonType returnType, string name, FuncPointer funcPointer, params PigeonType[] parameters)
 {
     if (returnType == PigeonType.Any)
     {
         functions.Add(name, new Function(PigeonType.String, name, parameters.Select(p => new Variable(p)).ToArray(), funcPointer));
         functions.Add(name + "_i", new Function(PigeonType.Int, name + "_i", parameters.Select(p => new Variable(p)).ToArray(), funcPointer));
         functions.Add(name + "_f", new Function(PigeonType.Float, name + "_f", parameters.Select(p => new Variable(p)).ToArray(), funcPointer));
         functions.Add(name + "_b", new Function(PigeonType.Bool, name + "_b", parameters.Select(p => new Variable(p)).ToArray(), funcPointer));
     }
     else
     {
         functions.Add(name, new Function(returnType, name, parameters.Select(p => new Variable(p)).ToArray(), funcPointer));
     }
 }