2
// <copyright see="prj:///doc/copyright.txt"/>
3
// <license see="prj:///doc/license.txt"/>
4
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
5
// <version>$Revision: 4482 $</version>
10
namespace ICSharpCode.OldNRefactory.Parser
12
public enum LiteralFormat : byte
19
VerbatimStringLiteral,
26
internal readonly int kind;
28
internal readonly int col;
29
internal readonly int line;
31
internal readonly LiteralFormat literalFormat;
32
internal readonly object literalValue;
33
internal readonly string val;
35
readonly Location endLocation;
41
public LiteralFormat LiteralFormat {
42
get { return literalFormat; }
45
public object LiteralValue {
46
get { return literalValue; }
53
public Location EndLocation {
54
get { return endLocation; }
57
public Location Location {
59
return new Location(col, line);
63
public Token(int kind) : this(kind, 0, 0)
67
public Token(int kind, int col, int line) : this (kind, col, line, null)
71
public Token(int kind, int col, int line, string val)
77
this.endLocation = new Location(col + (string.IsNullOrEmpty(val) ? 1 : val.Length), line);
80
internal Token(int kind, int x, int y, string val, object literalValue, LiteralFormat literalFormat)
81
: this(kind, new Location(x, y), new Location(x + val.Length, y), val, literalValue, literalFormat)
85
public Token(int kind, Location startLocation, Location endLocation, string val, object literalValue, LiteralFormat literalFormat)
88
this.col = startLocation.Column;
89
this.line = startLocation.Line;
90
this.endLocation = endLocation;
92
this.literalValue = literalValue;
93
this.literalFormat = literalFormat;
96
public override string ToString()
98
return string.Format("[C# {0}/VB {1} Location={2} EndLocation={3} val={4}]",
99
CSharp.Tokens.GetTokenString(kind),
100
VB.Tokens.GetTokenString(kind),