Example #1
0
 public Calculation(Environs _environment)
 {
     environment = _environment;
 }
Example #2
0
    /// <summary>
    /// Устанавливает новый код и автоматически распознаёт его содержимое
    /// </summary>
    /// <param name="_code"></param>
    public void SetCode(string _code)
    {
        env = new Environs();
        program = new ProgramStruct();
        program.program_tree = GetProgramTree(_code.ToLower());
        program.program_tree.Dump();
        program.consts = GetTypesStruct(program.program_tree, "const");
        program.types = GetTypesStruct(program.program_tree, "type");
        program.vars = GetTypesStruct(program.program_tree, "var");

        CheckConflictNames();

        cursor = GetElementCursor(program.program_tree, "begin");
        if (cursor.HasChild())
            cursor = cursor.GetFirstChild();
        else
            cursor = null;

        InitConstant();
        InitVariable();
    }