private void CantCloseBlock(StatementTypes type) { string error; if (type == StatementTypes.LOOP) { if (currentBlock.parent is BlockFor) { error = ERROR_MISSING_ENDIF; CloseParentBlock(); } else { error = ERROR_EXTRA_NEXT; } } else { if (currentBlock.parent is BlockIf) { error = ERROR_MISSING_NEXT; CloseParentBlock(); } else { error = ERROR_EXTRA_ENDIF; } } errors.Add(error); }
public Statement(Block block, StatementTypes sType, Variable.Object var, Variable.Object val, string note) { gBlock = block; gAct = gBlock.Actuator; gStatementType = sType; //gArgs = args; gObjVar = var; gObjVal = val; gszNote = note; }
private void OpenBlock(StatementTypes type) { if (type == StatementTypes.LOOP) { currentBlock.child = new BlockFor(currentBlock, null); } else { currentBlock.child = new BlockIf(currentBlock, null); } currentBlock = currentBlock.child; }
private void CloseBlock(StatementTypes type) { bool hasNoChild = (currentBlock.child == null); bool isExpectedBlock = (type == StatementTypes.LOOP) ? (currentBlock is BlockFor) : (currentBlock is BlockIf); if (hasNoChild && isExpectedBlock) { CloseCurrentBlock(); } else { CantCloseBlock(type); } }
public NewStatementForm(HTNEditorForm parent, List <Variable> variables, StatementTypes type) { InitializeComponent(); this.parent = parent; this.PossibleVariables = variables; variableBindingSource.DataSource = PossibleVariables; switch (type) { case StatementTypes.Condition: Text = "New Conditon"; break; case StatementTypes.Effect: Text = "New Effect"; break; default: break; } }
public Statement(string name, StatementTypes type) { Name = name; this.type = type; }