private void CollectPtgs(TokenCollector temp) { if (IsIf(_token)) { CollectIfPtgs(temp); return; } bool isPreFixOperator = _token is MemFuncPtg || _token is MemAreaPtg; if (isPreFixOperator) { temp.Add(_token); } for (int i = 0; i < GetChildren().Length; i++) { GetChildren()[i].CollectPtgs(temp); } if (!isPreFixOperator) { temp.Add(_token); } }
private void CollectPtgs(TokenCollector temp) { if (IsIf(this.Token)) { CollectIfPtgs(temp); return; } for (int i = 0; i < Children.Length; i++) { Children[i].CollectPtgs(temp); } temp.Add(this.Token); }
private void CollectPtgs(TokenCollector temp) { if (IsIf(GetToken())) { CollectIfPtgs(temp); return; } for (int i = 0; i < GetChildren().Length; i++) { GetChildren()[i].CollectPtgs(temp); } temp.Add(GetToken()); }
/** * The IF() function Gets marked up with two or three tAttr Tokens. * Similar logic will be required for CHOOSE() when it is supported * * See excelfileformat.pdf sec 3.10.5 "tAttr (19H) */ private void CollectIfPtgs(TokenCollector temp) { // condition goes first GetChildren()[0].CollectPtgs(temp); // placeholder for tAttrIf int ifAttrIndex = temp.CreatePlaceholder(); // true parameter GetChildren()[1].CollectPtgs(temp); // placeholder for first skip attr int skipAfterTrueParamIndex = temp.CreatePlaceholder(); int trueParamSize = temp.sumTokenSizes(ifAttrIndex + 1, skipAfterTrueParamIndex); AttrPtg attrIf = AttrPtg.CreateIf(trueParamSize + 4);// distance to start of false parameter/tFuncVar. +4 for tAttrSkip after true if (GetChildren().Length > 2) { // false param present // false parameter GetChildren()[2].CollectPtgs(temp); int skipAfterFalseParamIndex = temp.CreatePlaceholder(); int falseParamSize = temp.sumTokenSizes(skipAfterTrueParamIndex + 1, skipAfterFalseParamIndex); AttrPtg attrSkipAfterTrue = AttrPtg.CreateSkip(falseParamSize + 4 + 4 - 1); // 1 less than distance to end of if FuncVar(size=4). +4 for attr skip before AttrPtg attrSkipAfterFalse = AttrPtg.CreateSkip(4 - 1); // 1 less than distance to end of if FuncVar(size=4). temp.SetPlaceholder(ifAttrIndex, attrIf); temp.SetPlaceholder(skipAfterTrueParamIndex, attrSkipAfterTrue); temp.SetPlaceholder(skipAfterFalseParamIndex, attrSkipAfterFalse); } else { // false parameter not present AttrPtg attrSkipAfterTrue = AttrPtg.CreateSkip(4 - 1); // 1 less than distance to end of if FuncVar(size=4). temp.SetPlaceholder(ifAttrIndex, attrIf); temp.SetPlaceholder(skipAfterTrueParamIndex, attrSkipAfterTrue); } temp.Add(GetToken()); }
/** * The IF() function Gets marked up with two or three tAttr Tokens. * Similar logic will be required for CHOOSE() when it is supported * * See excelfileformat.pdf sec 3.10.5 "tAttr (19H) */ private void CollectIfPtgs(TokenCollector temp) { // condition goes first GetChildren()[0].CollectPtgs(temp); // placeholder for tAttrIf int ifAttrIndex = temp.CreatePlaceholder(); // true parameter GetChildren()[1].CollectPtgs(temp); // placeholder for first skip attr int skipAfterTrueParamIndex = temp.CreatePlaceholder(); int trueParamSize = temp.sumTokenSizes(ifAttrIndex + 1, skipAfterTrueParamIndex); AttrPtg attrIf = AttrPtg.CreateIf(trueParamSize + 4);// distance to start of false parameter/tFuncVar. +4 for tAttrSkip after true if (GetChildren().Length > 2) { // false param present // false parameter GetChildren()[2].CollectPtgs(temp); int skipAfterFalseParamIndex = temp.CreatePlaceholder(); int falseParamSize = temp.sumTokenSizes(skipAfterTrueParamIndex + 1, skipAfterFalseParamIndex); AttrPtg attrSkipAfterTrue = AttrPtg.CreateSkip(falseParamSize + 4 + 4 - 1); // 1 less than distance to end of if FuncVar(size=4). +4 for attr skip before AttrPtg attrSkipAfterFalse = AttrPtg.CreateSkip(4 - 1); // 1 less than distance to end of if FuncVar(size=4). temp.SetPlaceholder(ifAttrIndex, attrIf); temp.SetPlaceholder(skipAfterTrueParamIndex, attrSkipAfterTrue); temp.SetPlaceholder(skipAfterFalseParamIndex, attrSkipAfterFalse); } else { // false parameter not present AttrPtg attrSkipAfterTrue = AttrPtg.CreateSkip(4 - 1); // 1 less than distance to end of if FuncVar(size=4). temp.SetPlaceholder(ifAttrIndex, attrIf); temp.SetPlaceholder(skipAfterTrueParamIndex, attrSkipAfterTrue); } temp.Add(GetToken()); }
private void CollectPtgs(TokenCollector temp) { if (IsIf(_token)) { CollectIfPtgs(temp); return; } bool isPreFixOperator = _token is MemFuncPtg || _token is MemAreaPtg; if (isPreFixOperator) { temp.Add(_token); } for (int i = 0; i < GetChildren().Length; i++) { GetChildren()[i].CollectPtgs(temp); } if(!isPreFixOperator) { temp.Add(_token); } }
private void CollectPtgs(TokenCollector temp) { if (IsIf(this.Token)) { CollectIfPtgs(temp); return; } for (int i = 0; i < Children.Length; i++) { Children[i].CollectPtgs(temp); } temp.Add(this.Token); }
private void CollectPtgs(TokenCollector temp) { if (IsIf(GetToken())) { CollectIfPtgs(temp); return; } for (int i = 0; i < GetChildren().Length; i++) { GetChildren()[i].CollectPtgs(temp); } temp.Add(GetToken()); }
/** * The IF() function Gets marked up with two or three tAttr Tokens. * Similar logic will be required for CHOOSE() when it Is supported * * See excelfileformat.pdf sec 3.10.5 "tAttr (19H) */ private void collectIfPtgs(TokenCollector temp) { // condition goes first GetChildren()[0].collectPtgs(temp); // placeholder for tAttrIf int ifAttrIndex = temp.CreatePlaceholder(); // true parameter GetChildren()[1].collectPtgs(temp); // placeholder for first skip attr int skipAfterTrueParamIndex = temp.CreatePlaceholder(); int trueParamSize = temp.sumTokenSizes(ifAttrIndex + 1, skipAfterTrueParamIndex); AttrPtg attrIf = new AttrPtg(); attrIf.IsOptimizedIf=(true); AttrPtg attrSkipAfterTrue = new AttrPtg(); attrSkipAfterTrue.IsGoto=(true); if (GetChildren().Length > 2) { // false param present // false parameter GetChildren()[2].collectPtgs(temp); int skipAfterFalseParamIndex = temp.CreatePlaceholder(); AttrPtg attrSkipAfterFalse = new AttrPtg(); attrSkipAfterFalse.IsGoto=(true); int falseParamSize = temp.sumTokenSizes(skipAfterTrueParamIndex + 1, skipAfterFalseParamIndex); attrIf.Data=((short)(trueParamSize + 4)); // distance To start of false parameter. +4 for skip after true attrSkipAfterTrue.Data=((short)(falseParamSize + 4 + 4 - 1)); // 1 less than distance To end of if FuncVar(size=4). +4 for attr skip before attrSkipAfterFalse.Data=((short)(4 - 1)); // 1 less than distance To end of if FuncVar(size=4). temp.SetPlaceholder(ifAttrIndex, attrIf); temp.SetPlaceholder(skipAfterTrueParamIndex, attrSkipAfterTrue); temp.SetPlaceholder(skipAfterFalseParamIndex, attrSkipAfterFalse); } else { // false parameter not present attrIf.Data=((short)(trueParamSize + 4)); // distance To start of FuncVar. +4 for skip after true attrSkipAfterTrue.Data=((short)(4 - 1)); // 1 less than distance To end of if FuncVar(size=4). temp.SetPlaceholder(ifAttrIndex, attrIf); temp.SetPlaceholder(skipAfterTrueParamIndex, attrSkipAfterTrue); } temp.Add(GetToken()); }