コード例 #1
0
ファイル: ASTTableGet.cs プロジェクト: Szune/EGScript
 public ASTTableGet(ASTExpressionBase variable, ASTExpressionBase tableIndex)
 {
     Variable     = variable;
     TableIndexes = new List <ASTExpressionBase> {
         tableIndex
     };
 }
コード例 #2
0
 public ASTFor(ASTExpressionBase initializer, ASTExpressionBase condition, ASTExpressionBase incrementer, ASTStatementBase body)
 {
     Initializer = initializer;
     Condition   = condition;
     Incrementer = incrementer;
     Body        = body;
 }
コード例 #3
0
ファイル: ASTTable.cs プロジェクト: Szune/EGScript
        public bool InsertValue(ASTExpressionBase key, ASTExpressionBase value)
        {
            if (key == null)
            {
                AutoIntegerValues.Add(AutoIntegerValues.Count, new ASTTableElement(AutoIntegerValues.Count, value));
                return(true);
            }

            if (key.Type == ExpressionType.NUMBER)
            {
                var numberKey = key as ASTNumber;
                if (IntegerValues.ContainsKey((int)numberKey.Value)) // TODO: Do something to stop this from possibly crashing.. someday. (double to int cast)
                {
                    return(false);
                }
                IntegerValues.Add((int)numberKey.Value, new ASTTableElement((int)numberKey.Value, value));
            }
            else if (key.Type == ExpressionType.STRING)
            {
                var stringKey = key as ASTString;
                if (StringValues.ContainsKey(stringKey.Text))
                {
                    return(false);
                }
                StringValues.Add(stringKey.Text, new ASTTableElement(stringKey.Text, value));
            }
            else if (key.Type == ExpressionType.IDENTIFIER)
            {
                var identifierKey = key as ASTIdentifier;
                if (StringValues.ContainsKey(identifierKey.Name))
                {
                    return(false);
                }
                StringValues.Add(identifierKey.Name, new ASTTableElement(identifierKey.Name, value));
            }
            else
            {
                return(false);
            }
            return(true);
        }
コード例 #4
0
ファイル: ASTTableElement.cs プロジェクト: Szune/EGScript
 public ASTTableElement(int key, ASTExpressionBase value)
 {
     IntKey = key;
     Value  = value;
     Type   = ExpressionType.NUMBER;
 }
コード例 #5
0
ファイル: ASTTableElement.cs プロジェクト: Szune/EGScript
 public ASTTableElement(string key, ASTExpressionBase value)
 {
     StringKey = key;
     Value     = value;
     Type      = ExpressionType.STRING;
 }
コード例 #6
0
ファイル: ASTAssignment.cs プロジェクト: Szune/EGScript
 public ASTAssignment(AssignmentType opType, string variable, ASTExpressionBase expression)
 {
     OperationType = opType;
     Variable      = variable;
     Expression    = expression;
 }
コード例 #7
0
ファイル: ASTMemberAssignment.cs プロジェクト: Szune/EGScript
 public ASTMemberAssignment(AssignmentType opType, string variable, ASTExpressionBase expression) : base(opType, variable, expression)
 {
 }
コード例 #8
0
ファイル: ASTCompare.cs プロジェクト: Szune/EGScript
 public ASTCompare(OperationType type, ASTExpressionBase left, ASTExpressionBase right)
 {
     ComparisonType = type;
     Left           = left;
     Right          = right;
 }
コード例 #9
0
 public ASTReturn(ASTExpressionBase returnExpression)
 {
     ReturnExpression = returnExpression;
 }
コード例 #10
0
 public ASTStatementExpression(ASTExpressionBase expression)
 {
     Expression = expression;
 }
コード例 #11
0
 public ASTUnaryMathOperation(OperationType type, ASTExpressionBase expression)
 {
     MathOperationType = type;
     Expression        = expression;
 }
コード例 #12
0
ファイル: ASTIf.cs プロジェクト: Szune/EGScript
 public ASTIf(ASTExpressionBase condition, ASTStatementBase ifPart, ASTStatementBase elsePart) : this(condition, ifPart)
 {
     ElsePart = elsePart;
 }
コード例 #13
0
ファイル: ASTIf.cs プロジェクト: Szune/EGScript
 public ASTIf(ASTExpressionBase condition, ASTStatementBase ifPart)
 {
     Condition = condition;
     IfPart    = ifPart;
 }
コード例 #14
0
 public ASTGlobalVariableAssignment(string variable, ASTExpressionBase expression) : base(AssignmentType.ASSIGNMENT, variable, expression)
 {
 }
コード例 #15
0
 public ASTWhile(ASTExpressionBase condition, ASTStatementBase body)
 {
     Condition = condition;
     Body      = body;
 }
コード例 #16
0
ファイル: ASTTableGet.cs プロジェクト: Szune/EGScript
 public ASTTableGet(ASTExpressionBase variable, List <ASTExpressionBase> tableIndexes)
 {
     Variable     = variable;
     TableIndexes = tableIndexes;
 }
コード例 #17
0
 public ASTBinaryMathOperation(OperationType type, ASTExpressionBase left, ASTExpressionBase right)
 {
     MathOperationType = type;
     Left  = left;
     Right = right;
 }
コード例 #18
0
 public ASTMemberAssignmentInstance(AssignmentType opType, string variable, ASTExpressionBase expression, string instanceName) : base(opType, variable, expression)
 {
     InstanceName = instanceName;
 }