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

« back to all changes in this revision

Viewing changes to contrib/NRefactory/Project/Src/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
 
// <file>
2
 
//     <copyright see="prj:///doc/copyright.txt"/>
3
 
//     <license see="prj:///doc/license.txt"/>
4
 
//     <owner name="none" email=""/>
5
 
//     <version>$Revision: 4482 $</version>
6
 
// </file>
7
 
 
8
 
using System;
9
 
using System.Text;
10
 
 
11
 
namespace ICSharpCode.OldNRefactory.Parser
12
 
{
13
 
        public delegate void ErrorCodeProc(int line, int col, int n);
14
 
        public delegate void ErrorMsgProc(int line, int col, string msg);
15
 
        
16
 
        public class Errors
17
 
        {
18
 
                int count = 0;  // number of errors detected
19
 
                public ErrorCodeProc SynErr;
20
 
                public ErrorCodeProc SemErr;
21
 
                public ErrorMsgProc  Error;
22
 
                StringBuilder errorText = new StringBuilder();
23
 
                
24
 
                public string ErrorOutput {
25
 
                        get {
26
 
                                return errorText.ToString();
27
 
                        }
28
 
                }
29
 
                
30
 
                public Errors()
31
 
                {
32
 
                        SynErr = new ErrorCodeProc(DefaultCodeError);  // syntactic errors
33
 
                        SemErr = new ErrorCodeProc(DefaultCodeError);  // semantic errors
34
 
                        Error  = new ErrorMsgProc(DefaultMsgError);    // user defined string based errors
35
 
                }
36
 
                
37
 
                public int Count {
38
 
                        get {
39
 
                                return count;
40
 
                        }
41
 
                }
42
 
                
43
 
                void DefaultCodeError(int line, int col, int n)
44
 
                {
45
 
                        errorText.AppendLine(String.Format("-- line {0} col {1}: error {2}", line, col, n));
46
 
                        count++;
47
 
                }
48
 
        
49
 
                void DefaultMsgError(int line, int col, string s) {
50
 
                        errorText.AppendLine(String.Format("-- line {0} col {1}: {2}", line, col, s));
51
 
                        count++;
52
 
                }
53
 
        } // Errors
54
 
}