private CStatementBlock cases; // this will be a vector of case objects public CSelect(CToken token, CExpression pivot) : base(token) { cases = new CStatementBlock(); this.pivot = pivot; pivot.Parent = this; }
private bool elseCaseFlag; // flag indicating if this case is the default case // if statements is null, that means there are no statements. meaning this case uses the statements // of the case below it. so dont put a break point. eg: // switch (color) { // case (red): // case (blue): // print("its red or blue); // break; // public CCase(CToken token, CExpression val) : base(token) { m_value = val; m_value.Parent = this; statements = null; }
// this is the constructor when you actually need to parse all the statements of a case // until you hit the next case public CCase(CToken token, CExpression val, CStatementBlock block) : base(token) { m_value = val; elseCaseFlag = val == null; if (!elseCaseFlag) { m_value.Parent = this; } statements = block; }