public int Match(uint[] input, int offset, string precedenceLevel, CircumfixGoalContainer container) { var ops = LongestToShortest(precedenceLevel); var os = offset; foreach (var op in ops) { if (op.Length + os > input.Length) { goto next; } foreach (var codepoint in op) { if (input[offset++] != codepoint) { goto next; } } container.Goal = new CircumfixGoal(this[new UTF32String(op).ToString()].Goal, container.Goal); return(offset - os); next: offset = os; } return(0); }
public int Match(uint[] input, int offset, CircumfixGoalContainer container) { var os = offset; var op = GoalText.Chars; if (op.Length + os > input.Length) { return(0); } foreach (var codepoint in op) { if (input[offset++] != codepoint) { return(0); } } container.Goal = container.Goal.Parent; // pop the stack return(offset - os); }