private void ParseErrorEvent(LALRParser parser, ParseErrorEventArgs args) { string message = "Parse error caused by token: ' " + args.UnexpectedToken.ToString() + " ' " + " in line : " + args.UnexpectedToken.Location.LineNr; //todo: Report message to UI? lstError.Items.Add(message); string message2 = "excepted token: '" + args.ExpectedTokens.ToString() + "'"; lstError.Items.Add(message2); }
private void FireParseError(TerminalToken token) { if (OnParseError != null) { ParseErrorEventArgs e = new ParseErrorEventArgs(token, FindExpectedTokens()); OnParseError(this, e); continueParsing = e.Continue != ContinueMode.Stop; lookahead = e.NextToken; if ((e.NextToken != null) && (e.Continue == ContinueMode.Insert)) { tokenizer.SetCurrentLocation(token.Location); } } }
private void ParseErrorEvent(LALRParser parser, ParseErrorEventArgs args) { string ExpectedTokens = "Expected Token : '" + args.ExpectedTokens.ToString() + "'"; errors.Items.Add(ExpectedTokens); string UnexpectedToken = "Wrong Token : '" + args.UnexpectedToken.ToString() + "'"; errors.Items.Add(UnexpectedToken); string errorLine = "Error Near By Line : " + args.UnexpectedToken.Location.LineNr; errors.Items.Add(errorLine); //todo: Report message to UI? }
private void ParseErrorEvent(LALRParser parser, ParseErrorEventArgs args) { /*** MODIFICAÇÕES ***/ String file_name = _mainForm.getFileName(); String error_type = "Syntax error"; String line_number = args.UnexpectedToken.Location.LineNr.ToString(); String col_number = args.UnexpectedToken.Location.ColumnNr.ToString(); String error_description = "Error at .. " + args.UnexpectedToken.ToString(); String unexpectedToken = args.UnexpectedToken.ToString(); String expectedTokens = args.ExpectedTokens.ToString(); String[] aExpectedTokens = expectedTokens.Split(' '); String nextToken = aExpectedTokens[0]; int token_id = 0; foreach (SymbolConstants symbol in (Enum.GetValues(typeof(SymbolConstants)))) { String symbol_token = symbol.ToString() .Replace("SYMBOL_", "") .ToLower(); if (symbol_token == nextToken) { token_id = (int)symbol; break; } } _insertError(file_name, error_type, line_number, col_number, error_description); Location location = new Location(0, 0, 0); args.NextToken = new TerminalToken(new SymbolTerminal(token_id, nextToken), "", location); args.Continue = ContinueMode.Insert; /*** MODIFICAÇÕES ***/ }
private void ParseErrorEvent(LALRParser parser, ParseErrorEventArgs args) { string message = "Parse error caused by token: '" + args.UnexpectedToken.ToString() + "'"; //todo: Report message to UI? }
private void ParseErrorEvent(LALRParser parser, ParseErrorEventArgs args) { MainForm.mainForm.ShowInputError(args.UnexpectedToken); MainForm.mainForm.WriteResult("Parse error caused by token: '" + args.UnexpectedToken.ToString() + "'"); }
/// <summary> /// Constructor /// </summary> /// <param name="arg">Parse Error Event Aruguments</param> public ParseException(ParseErrorEventArgs arg) : base(SharedStrings.WARNING_COMMAND_SYNTAX_ERROR + "\r\r" + SharedStrings.UNEXPECTED_TOKEN, arg.UnexpectedToken.Text) { args = arg; }
private void ParseErrorEvent(LALRParser parser, ParseErrorEventArgs args) { string message = "Parse error caused by token: '"+args.UnexpectedToken.ToString()+"'"; //todo: Report message to UI? }
private void ParseErrorEvent(LALRParser parser, ParseErrorEventArgs args) { throw new ParseException(args); }
private void FireParseError(TerminalToken token) { if (OnParseError != null) { ParseErrorEventArgs e = new ParseErrorEventArgs(token, FindExpectedTokens()); OnParseError(this, e); continueParsing = e.Continue != ContinueMode.Stop; lookahead = e.NextToken; if ((e.NextToken != null) && (e.Continue == ContinueMode.Insert)) tokenizer.SetCurrentLocation(token.Location); } }
private void lalrParser_OnParseError(LALRParser parser, ParseErrorEventArgs e) { // Ignore global parse errors OnParseComplete(EventArgs.Empty); }
protected virtual void ParseErrorEvent(LALRParser parser, ParseErrorEventArgs args) { string message = String.Format("Parse error caused by token: '{0}' at location {1}", args.UnexpectedToken, args.UnexpectedToken.Location); throw new ParserException(message); }
private void ParseErrorEvent(LALRParser parser, ParseErrorEventArgs args) { message = message + "Parse error caused by token: " + args.UnexpectedToken.ToString() + "\n" + "in line : " + args.UnexpectedToken.Location.LineNr + "\n"; //todo: Report message to UI? message = message + "expected token : " + args.ExpectedTokens.ToString() + "\n"; }
private void ParseErrorEvent(LALRParser parser, ParseErrorEventArgs args) { AddViewItem("Parse error", null, "Expecting the following tokens:", args.ExpectedTokens.ToString(),"",5); errors++; if (errors <= maxerrors) { args.Continue = ContinueMode.Skip; // example for inserting a new token /* args.Continue = ContinueMode.Insert; TerminalToken token = new TerminalToken((SymbolTerminal)parser.Symbols.Get(4), "555", new Location(0, 0, 0)); args.NextToken = token; */ } }
private void ParseErrorEvent(LALRParser parser, ParseErrorEventArgs args) { Context.ExpectedTokens = args.ExpectedTokens.ToString(); if(args.NextToken!=null) Context.NextToken = args.NextToken.ToString(); if (args.UnexpectedToken != null) Context.UnexpectedToken = args.UnexpectedToken.ToString(); throw new ParseException(args); }
private void ParseErrorEvent(LALRParser parser, ParseErrorEventArgs args) { MainForm.mainForm.ShowInputError(args.UnexpectedToken); MainForm.mainForm.WriteResult("Parse error caused by token: '"+args.UnexpectedToken.ToString()+"'"); }
private void FireParseError(TerminalToken token) { if (OnParseError != null) { ParseErrorEventArgs e = new ParseErrorEventArgs(token, FindExpectedTokens()); OnParseError(this, e); continueParsing = e.Continue; lookahead = e.NextToken; } }
private void parser_OnParseError(LALRParser parser, ParseErrorEventArgs args) { string message; message=args.UnexpectedToken.Location+",unexpect token:"+args.UnexpectedToken.Text; throw new Exception(message); }
private void ParseErrorEvent(LALRParser parser, ParseErrorEventArgs args) { string message = args.UnexpectedToken.Location.ToString()+"[\n\r"; message+="Unexpected Token: '"+args.UnexpectedToken.ToString()+"'\n\rExpected: '"+args.ExpectedTokens.ToString()+"'"; if (LastGotoEventArgs!=null) message+="\n\rLastGoto:"+LastGotoEventArgs.Symbol.ToString(); if (LastReduceEventArgs!=null) message+="\n\rLastReduce.Rule:"+LastReduceEventArgs.Rule.ToString(); message+="\n\r]"; Console.WriteLine(message); }
private void ParseErrorEvent(LALRParser argParser, ParseErrorEventArgs args) { WriteError("Parse error caused by token: '" + args.UnexpectedToken + "'" + " at " + args.UnexpectedToken.Location, args.UnexpectedToken.Location); args.Continue = ContinueMode.Insert; }