Skip to content

Commit

Permalink
fixed prec bug
Browse files Browse the repository at this point in the history
  • Loading branch information
rivantsov committed Mar 11, 2013
1 parent 8a9dc81 commit 0836e24
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Binary file not shown.
Empty file added pingme.txt
Empty file.

0 comments on commit 0836e24

Please sign in to comment.