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

« back to all changes in this revision

Viewing changes to external/nrefactory/ICSharpCode.NRefactory.VB/Ast/Expressions/XmlIdentifier.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
 
 
6
namespace ICSharpCode.NRefactory.VB.Ast
 
7
{
 
8
        /// <summary>
 
9
        /// Description of XmlIdentifier.
 
10
        /// </summary>
 
11
        public class XmlIdentifier : AstNode
 
12
        {
 
13
                public static readonly new XmlIdentifier Null = new NullXmlIdentifier();
 
14
                
 
15
                class NullXmlIdentifier : XmlIdentifier
 
16
                {
 
17
                        public override bool IsNull {
 
18
                                get {
 
19
                                        return true;
 
20
                                }
 
21
                        }
 
22
                        
 
23
                        public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
 
24
                        {
 
25
                                return default(S);
 
26
                        }
 
27
                        
 
28
                        protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
 
29
                        {
 
30
                                return other == null || other.IsNull;
 
31
                        }
 
32
                }
 
33
                
 
34
                public string Name { get; set; }
 
35
                
 
36
                TextLocation startLocation;
 
37
                public override TextLocation StartLocation {
 
38
                        get { return startLocation; }
 
39
                }
 
40
                
 
41
                TextLocation endLocation;
 
42
                public override TextLocation EndLocation {
 
43
                        get { return endLocation; }
 
44
                }
 
45
                
 
46
                private XmlIdentifier()
 
47
                {
 
48
                        this.Name = string.Empty;
 
49
                }
 
50
                
 
51
                public XmlIdentifier(string name, TextLocation startLocation, TextLocation endLocation)
 
52
                {
 
53
                        this.Name = name;
 
54
                        this.startLocation = startLocation;
 
55
                        this.endLocation = endLocation;
 
56
                }
 
57
                
 
58
                protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
 
59
                {
 
60
                        var ident = other as XmlIdentifier;
 
61
                        return ident != null
 
62
                                && MatchStringXml(Name, ident.Name)
 
63
                                && ident.startLocation == startLocation
 
64
                                && ident.endLocation == endLocation;
 
65
                }
 
66
                
 
67
                public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
 
68
                {
 
69
                        return visitor.VisitXmlIdentifier(this, data);
 
70
                }
 
71
        }
 
72
}