2
* Created by SharpDevelop.
7
* To change this template use Tools | Options | Coding | Edit Standard Headers.
11
namespace ICSharpCode.NRefactory.VB.Ast
14
/// Description of VBTokenNode.
16
public class VBTokenNode : AstNode
18
public static new readonly VBTokenNode Null = new NullVBTokenNode();
20
class NullVBTokenNode : VBTokenNode
22
public override bool IsNull {
28
public NullVBTokenNode() : base (TextLocation.Empty, 0)
32
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
37
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
39
return other == null || other.IsNull;
43
TextLocation startLocation;
44
public override TextLocation StartLocation {
50
protected int tokenLength = -1;
52
TextLocation endLocation;
53
public override TextLocation EndLocation {
55
return tokenLength < 0 ? endLocation : new TextLocation(startLocation.Line, startLocation.Column + tokenLength);
59
public VBTokenNode(TextLocation location, int tokenLength)
61
this.startLocation = location;
62
this.tokenLength = tokenLength;
65
public VBTokenNode(TextLocation startLocation, TextLocation endLocation)
67
this.startLocation = startLocation;
68
this.endLocation = endLocation;
71
public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data)
73
return visitor.VisitVBTokenNode(this, data);
76
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
78
var node = other as VBTokenNode;
79
return node != null && !node.IsNull;
82
public override string ToString ()
84
return string.Format ("[VBTokenNode: StartLocation={0}, EndLocation={1}, Role={2}]", StartLocation, EndLocation, Role);