diff --git a/Irony/Parsing/Parser/SpecialActionsHints/PrecedenceBasedParserAction.cs b/Irony/Parsing/Parser/SpecialActionsHints/PrecedenceBasedParserAction.cs index f325889..d1ef8b1 100644 --- a/Irony/Parsing/Parser/SpecialActionsHints/PrecedenceBasedParserAction.cs +++ b/Irony/Parsing/Parser/SpecialActionsHints/PrecedenceBasedParserAction.cs @@ -28,10 +28,12 @@ public PrecedenceBasedParserAction(BnfTerm shiftTerm, ParserState newShiftState, base.DefaultAction = _shiftAction = new ShiftParserAction(shiftTerm, newShiftState); } - private static bool CheckMustReduce(ParsingContext context) { + private bool CheckMustReduce(ParsingContext context) { var input = context.CurrentParserInput; - for (int i = context.ParserStack.Count - 1; i >= 0; i--) { - var prevNode = context.ParserStack[i]; + var stackCount = context.ParserStack.Count; + var prodLength = _reduceAction.Production.RValues.Count; + for (int i = 1; i <= prodLength; i++) { + var prevNode = context.ParserStack[stackCount - i]; if (prevNode == null) continue; if (prevNode.Precedence == BnfTerm.NoPrecedence) continue; //if previous operator has the same precedence then use associativity diff --git a/Microsoft.VisualStudio.TestTools.CppUnitTestFramework.CppUnitTestExtension.pdb/4B5DB1DDEF544449A37DD17CF9B843421/Microsoft.VisualStudio.TestTools.CppUnitTestFramework.CppUnitTestExtension.pdb b/Microsoft.VisualStudio.TestTools.CppUnitTestFramework.CppUnitTestExtension.pdb/4B5DB1DDEF544449A37DD17CF9B843421/Microsoft.VisualStudio.TestTools.CppUnitTestFramework.CppUnitTestExtension.pdb new file mode 100644 index 0000000..2192b9e Binary files /dev/null and b/Microsoft.VisualStudio.TestTools.CppUnitTestFramework.CppUnitTestExtension.pdb/4B5DB1DDEF544449A37DD17CF9B843421/Microsoft.VisualStudio.TestTools.CppUnitTestFramework.CppUnitTestExtension.pdb differ diff --git a/pingme.txt b/pingme.txt new file mode 100644 index 0000000..e69de29