~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to external/nrefactory/ICSharpCode.NRefactory.VB/Parser/Errors.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
Import upstream version 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 
2
// This code is distributed under MIT X11 license (for details please see \doc\license.txt)
 
3
 
 
4
using System;
 
5
using System.Text;
 
6
 
 
7
namespace ICSharpCode.NRefactory.VB.Parser
 
8
{
 
9
        public delegate void ErrorCodeProc(int line, int col, int n);
 
10
        public delegate void ErrorMsgProc(int line, int col, string msg);
 
11
        
 
12
        public class Errors
 
13
        {
 
14
                int count = 0;  // number of errors detected
 
15
                public ErrorCodeProc SynErr;
 
16
                public ErrorCodeProc SemErr;
 
17
                public ErrorMsgProc  Error;
 
18
                StringBuilder errorText = new StringBuilder();
 
19
                
 
20
                public string ErrorOutput {
 
21
                        get {
 
22
                                return errorText.ToString();
 
23
                        }
 
24
                }
 
25
                
 
26
                public Errors()
 
27
                {
 
28
                        SynErr = new ErrorCodeProc(DefaultCodeError);  // syntactic errors
 
29
                        SemErr = new ErrorCodeProc(DefaultCodeError);  // semantic errors
 
30
                        Error  = new ErrorMsgProc(DefaultMsgError);    // user defined string based errors
 
31
                }
 
32
                
 
33
                public int Count {
 
34
                        get {
 
35
                                return count;
 
36
                        }
 
37
                }
 
38
                
 
39
                void DefaultCodeError(int line, int col, int n)
 
40
                {
 
41
                        errorText.AppendLine(String.Format("-- line {0} col {1}: error {2}", line, col, n));
 
42
                        count++;
 
43
                }
 
44
        
 
45
                void DefaultMsgError(int line, int col, string s) {
 
46
                        errorText.AppendLine(String.Format("-- line {0} col {1}: {2}", line, col, s));
 
47
                        count++;
 
48
                }
 
49
        } // Errors
 
50
}