void Add(string message, Microsoft.Scripting.SourceSpan span) { lv.Items.Add(new ListViewItem(new[] { message, span.Start.Line.ToString(), span.Start.Column.ToString() }) { Tag = span }); }
public override void ErrorReported(ScriptSource source, string message, Microsoft.Scripting.SourceSpan span, int errorCode, Microsoft.Scripting.Severity severity) { Message = message; ErrorCode = errorCode; sev = severity; Span = span; }
public override void ErrorReported(ScriptSource source, string message, Microsoft.Scripting.SourceSpan span, int errorCode, Microsoft.Scripting.Severity severity) { Errors.Add(new ProgramError { Line = span.Start.Line, Column = span.Start.Column, ErrorMessage = message, ErrorNumber = errorCode.ToString(), CodeBlock = blockType }); }
private bool Parse() { _nextToken = 0; _currentState = _states[0]; _lastTokenSpan = GetTokenSpan(); _stack.Push(_currentState, yyval, yyloc); while (true) { LogStateEntered(); int action = _currentState.DefaultAction; if (_currentState.Actions != null) { if (_nextToken == 0) { // We save the last token span, so that the location span // of production right hand sides that begin or end with a // nullable production will be correct. _lastTokenSpan = GetTokenSpan(); _nextToken = GetNextToken(); } LogNextToken(_nextToken); _currentState.Actions.TryGetValue(_nextToken, out action); } if (action > 0) { LogBeforeShift(action, _nextToken, false); Shift(action); } else if (action < 0) { Reduce(-action - 1); // accept if (action == -1) { return(true); } } else if (action == 0) { // error if (!ErrorRecovery()) { return(false); } } } }
private void Reduce(int ruleId) { int ruleDef = _rules[ruleId]; int rhsLength = GetRuleRhsLength(ruleDef); LogBeforeReduction(ruleId, rhsLength); if (rhsLength == 0) { // The location span for an empty production will start with the // beginning of the next lexeme, and end with the finish of the // previous lexeme. This gives the correct behaviour when this // nonsense value is used in later Merge operations. yyloc = MergeLocations(_lastTokenSpan, GetTokenSpan()); } else if (rhsLength == 1) { yyloc = _stack.PeekLocation(1); } else { TLocation at1 = GetLocation(rhsLength); TLocation atN = GetLocation(1); yyloc = MergeLocations(at1, atN); } DoAction(ruleId); _stack.Pop(rhsLength); var currentState = _stack.PeekState(1); int gotoState; if (currentState.GotoStates.TryGetValue(GetRuleLhsNonterminal(ruleDef), out gotoState)) { LogBeforeGoto(gotoState, ruleId); currentState = _states[gotoState]; } _stack.Push(currentState, yyval, yyloc); _currentState = currentState; }
private bool Parse() { _nextToken = 0; _currentState = _states[0]; _lastTokenSpan = GetTokenSpan(); _stack.Push(_currentState, yyval, yyloc); while (true) { LogStateEntered(); int action = _currentState.DefaultAction; if (_currentState.Actions != null) { if (_nextToken == 0) { // We save the last token span, so that the location span // of production right hand sides that begin or end with a // nullable production will be correct. _lastTokenSpan = GetTokenSpan(); _nextToken = GetNextToken(); } LogNextToken(_nextToken); _currentState.Actions.TryGetValue(_nextToken, out action); } if (action > 0) { LogBeforeShift(action, _nextToken, false); Shift(action); } else if (action < 0) { Reduce(-action - 1); // accept if (action == -1) { return true; } } else if (action == 0) { // error if (!ErrorRecovery()) { return false; } } } }
public override void Add(string message, string path, string code, string line, Microsoft.Scripting.SourceSpan span, int errorCode, Microsoft.Scripting.Severity severity) { Add(message, span); }
public override void Add(Microsoft.Scripting.SourceUnit source, string message, Microsoft.Scripting.SourceSpan span, int errorCode, Microsoft.Scripting.Severity severity) { Add(message, span); }