public override CSResult BuildToCS(BuildEnvironment Env)
        {
            BuildVariableType typeOfAssignment = BuildVariableType.Undefined;
            string            value            = "null";

            if (Value is BooleanParseNode)
            {
                typeOfAssignment = BuildVariableType.Boolean;
                value            = (Value as BooleanParseNode).Value ? "true" : "false";
            }
            else if (Value is NullParseNode)
            {
                typeOfAssignment = BuildVariableType.Null;
                value            = "null";
            }
            else if (Value is ParseNodeList)
            {
                typeOfAssignment = BuildVariableType.Numeric;
                value            = "";
                List <ParseNode> wordNodes = (Value as ParseNodeList).GetNodes();
                wordNodes.ForEach(pn => value += (pn as WordParseNode).Text.Length % 10);
            }
            else if (Value is StringParseNode)
            {
                typeOfAssignment = BuildVariableType.String;
                value            = (Value as StringParseNode).Value;
            }

            CSLineList cs = new CSLineList();

            if (Env.CurrentContext.VariableExists(Variable.Name))
            {
                BuildVariable existingVar = Env.CurrentContext.GetVariable(Variable.Name);
                if (existingVar.Type != typeOfAssignment)
                {
                    existingVar.CodeCount++;
                    existingVar.Type = typeOfAssignment;
                    cs.Add(existingVar.CSType + " " + existingVar.CodeName + " = " + value + ";", T.LineNumber);
                }
                else
                {
                    cs.Add(existingVar.CodeName + " = " + value + ";", T.LineNumber);
                }
            }
            else
            {
                BuildVariable newVariable = new BuildVariable(typeOfAssignment, Variable.Name);
                Env.CurrentContext.AddVariable(newVariable);
                cs.Add(newVariable.CSType + " " + newVariable.CodeName + " = " + value + ";", T.LineNumber);
            }
            return(new CSResult()
            {
                GeneratedCS = cs, ReturnType = null
            });
        }
 public BuildVariable(BuildVariableType Type, string Name)
 {
     this.Type = Type;
     this.Name = Name;
     _CodeName = "";
     CodeCount = 0;
     foreach (char c in Name)
     {
         if (!((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
         {
             _CodeName += "_";
         }
         else
         {
             _CodeName += c;
         }
     }
 }