/// <summary> /// Parses the input and returns the result /// </summary> /// <returns>A ParseResult object containing the data about the result</returns> public override ParseResult Parse() { Lexer.TokenKernel nextKernel = lexer.GetNextToken(this); while (true) { LRActionCode action = ParseOnToken(nextKernel); if (action == LRActionCode.Shift) { nextKernel = lexer.GetNextToken(this); continue; } if (action == LRActionCode.Accept) { return(new ParseResult(new ROList <ParseError>(allErrors), lexer.Input, builder.GetTree())); } nextKernel = OnUnexpectedToken(nextKernel); if (nextKernel.TerminalID == Symbol.SID_NOTHING || allErrors.Count >= MAX_ERROR_COUNT) { return(new ParseResult(new ROList <ParseError>(allErrors), lexer.Input)); } } }
/// <summary> /// Loads this LR Action from the specified input /// </summary> /// <param name="input">An input</param> public LRAction(BinaryReader input) { code = (LRActionCode)(input.ReadUInt16()); data = input.ReadUInt16(); }