Example #1
0
        private void MarkError(ParserSyntaxError error)
        {
            //DocumentPosition pos = ;
            int                offset         = error.StartOffset == -1 ? editor.Document.PositionToOffset(new DocumentPosition(error.LineNumber, 0)) : error.StartOffset;
            DynamicToken       token          = (DynamicToken)editor.Document.Tokens.GetTokenAtOffset(offset);
            SpanIndicatorLayer indicatorLayer = editor.Document.SpanIndicatorLayers[ErrorLayerKey];
            SpanIndicator      indicator      = new WaveLineSpanIndicator("ErrorIndicator", Color.Red);

            if (indicatorLayer == null)
            {
                indicatorLayer = new SpanIndicatorLayer(ErrorLayerKey, 1);
                editor.Document.SpanIndicatorLayers.Add(indicatorLayer);
            }
            int startOffset = Math.Min(token.StartOffset, indicatorLayer.Document.Length - 1);
            int length      = Math.Max(token.Length, 1);

            if (startOffset < 0)
            {
                return;                 // don't add indicators for errors without an offset.
            }
            SpanIndicator[] indicators = indicatorLayer.GetIndicatorsForTextRange(new ActiproSoftware.SyntaxEditor.TextRange(startOffset, startOffset + length));
            foreach (SpanIndicator i in indicators)
            {
                // If there is already an error indicator on that word, don't add another one.
                if (i.TextRange.StartOffset == startOffset && i.TextRange.Length == length)
                {
                    continue;
                }
            }
            indicatorLayer.Add(indicator, startOffset, length);
        }
Example #2
0
 public void ShowParseErrors(ParserSyntaxError error)
 {
     listBoxFiles.Items.Add(Path.GetFileName(error.FileName));
     ShowParseError(error);
     this.TopMost = true;
     this.ShowDialog(this.ParentForm);
 }
Example #3
0
 private void ShowParseError(ParserSyntaxError error)
 {
     this.Text   = "Parse Error: " + error.Filename;
     label1.Text = string.Format("{0} could not be parsed. There seems to be a syntax error near line {1}, column {2}. Please fix the error before trying to parse again. If you believe the code is syntactically correct then please send a copy of the file to [email protected]", error.FileName, error.LineNumber, error.StartPos);
     SetSyntaxLanguage();
     syntaxEditor1.Text = error.OriginalText;
     MarkErrorWord(syntaxEditor1, error.LineNumber, error.StartPos, "Parse Error");
 }
Example #4
0
        private void AddErrorToToolWindow(ParserSyntaxError error)
        {
            Node node = new Node();

            errorTreeList.Nodes.Add(node);

            node.Cells.Add(new Cell());
            node.Cells.Add(new Cell());

            node.Text          = error.LineNumber.ToString();
            node.Cells[1].Text = error.StartOffset.ToString();
            node.Cells[2].Text = error.ErrorMessage;

            errorToolWindow.Activate();
            errorToolWindow.State = ActiproSoftware.UIStudio.Dock.ToolWindowState.DockableInsideHost;
        }
Example #5
0
 public void AddError(ParserSyntaxError parseError)
 {
     errors.Add(parseError);
 }
 public FileParseErrorArgs(ParserSyntaxError parseError, FileVersion fileVersion, IFileInformation fileInfo)
 {
     this.parseError  = parseError;
     this.fileVersion = fileVersion;
     this.fileInfo    = fileInfo;
 }