/// <summary> /// The following code executes when a syntax error first occurs. /// </summary> private void SyntaxError(int major, Minor minor) { Parse parse = this._parse; #line 5 "C:\\_APPLICATION\\FEASERVER\\ENGINE_\\FeaServer.Query\\Parser.y" Debug.Assert(!string.IsNullOrEmpty(TOKEN)); // The tokenizer always gives us a token parse.ErrorMsg("near \"%T\": syntax error", TOKEN); this._parse = parse; }
/// <summary> /// The following code executes when the parse fails /// </summary> // Here code is inserted which will be executed whenever the parser fails private void ParseFailed() { Parse parse = this._parse; if ((this._tracePrompt != null)) { Trace.WriteLine(String.Format("{0}Fail!", this._tracePrompt)); } for ( ; (this._idx >= 0); ) { this.PopParserStack(); } this._parse = parse; }
/// <summary> /// The following routine is called if the stack overflows. /// </summary> private void StackOverflow(Minor minor) { Parse parse = this._parse; this._idx = (this._idx + 1); if ((this._tracePrompt != null)) { Trace.WriteLine(String.Format("{0}Stack Overflow!", this._tracePrompt)); } for ( ; (this._idx >= 0); ) { this.PopParserStack(); } // Here code is inserted which will execute if the parser stack every overflows #line 9 "C:\\_APPLICATION\\FEASERVER\\ENGINE_\\FeaServer.Query\\Parser.y" parse.ErrorMsg("parser stack overflow"); this._parse = parse; }
// <summary> // The main parser. // </summary> public virtual void Parse(int major, Token minor, Parse parse) { if ((this._idx < 0)) { this._idx = 0; this._errors = -1; this._stack[0].stateno = 0; this._stack[0].major = 0; } Minor minorUnion = _zeroMinor; minorUnion.yy0 = minor; bool endOfInput = (major == 0); this._parse = parse; if ((this._tracePrompt != null)) { Trace.WriteLine(String.Format("{0}Input {1}", this._tracePrompt, _tokenNames[major])); } for (bool do1 = true; do1; do1 = ((major != NOCODE) && (this._idx >= 0))) { int action = this.FindShiftAction(((byte)(major))); if ((action < STATES)) { Debug.Assert((endOfInput == false)); this.Shift(action, major, minorUnion); this._errors = (this._errors + 1); major = NOCODE; } else { if ((action < 473)) { this.Reduce((action - STATES)); } else { Debug.Assert((action == ERROR_ACTION)); if ((this._tracePrompt != null)) { Trace.WriteLine(String.Format("{0}Syntax Error!", this._tracePrompt)); } if ((this._errors <= 0)) { this.SyntaxError(major, minorUnion); } this._errors = 3; this.Destructor(((byte)(major)), minorUnion); if ((endOfInput == true)) { this.ParseFailed(); } major = NOCODE; } } } }