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

« back to all changes in this revision

Viewing changes to contrib/NRefactory/Project/Src/Parser/ModifierList.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 ICSharpCode.OldNRefactory.Ast;
9
 
 
10
 
namespace ICSharpCode.OldNRefactory.Parser
11
 
{
12
 
        internal class ModifierList
13
 
        {
14
 
                Modifiers cur;
15
 
                Location location = new Location(-1, -1);
16
 
                
17
 
                public Modifiers Modifier {
18
 
                        get {
19
 
                                return cur;
20
 
                        }
21
 
                        set {
22
 
                                cur = value;
23
 
                        }
24
 
                }
25
 
                
26
 
                public Location GetDeclarationLocation(Location keywordLocation)
27
 
                {
28
 
                        if(location.IsEmpty) {
29
 
                                return keywordLocation;
30
 
                        }
31
 
                        return location;
32
 
                }
33
 
                
34
 
//              public Location Location {
35
 
//                      get {
36
 
//                              return location;
37
 
//                      }
38
 
//                      set {
39
 
//                              location = value;
40
 
//                      }
41
 
//              }
42
 
                
43
 
                public bool isNone { get { return cur == Modifiers.None; } }
44
 
                
45
 
                public bool Contains(Modifiers m)
46
 
                {
47
 
                        return ((cur & m) != 0);
48
 
                }
49
 
                
50
 
                public void Add(Modifiers m, Location tokenLocation) 
51
 
                {
52
 
                        if(location.IsEmpty) {
53
 
                                location = tokenLocation;
54
 
                        }
55
 
                        if (m == Modifiers.Internal && (cur & Modifiers.Protected) != 0) {
56
 
                                cur = Modifiers.ProtectedAndInternal;
57
 
                                return;
58
 
                        }
59
 
                        if ((cur & m) == 0) {
60
 
                                cur |= m;
61
 
                        } else {
62
 
//                              parser.Error("modifier " + m + " already defined");
63
 
                        }
64
 
                }
65
 
                
66
 
//              public void Add(Modifiers m)
67
 
//              {
68
 
//                      Add(m.cur, m.Location);
69
 
//              }
70
 
                
71
 
                public void Check(Modifiers allowed)
72
 
                {
73
 
                        Modifiers wrong = cur & ~allowed;
74
 
                        if (wrong != Modifiers.None) {
75
 
//                              parser.Error("modifier(s) " + wrong + " not allowed here");
76
 
                        }
77
 
                }
78
 
        }
79
 
}