boolangstudio /Dependencies/boo/src/Boo.Lang.Parser/antlr/antlr/Token.cs

Language C# Lines 99
MD5 Hash 12b3ea45256024dedd3bd16085d40c49 Estimated Cost $1,606 (why?)
Repository https://github.com/w4x/boolangstudio.git View Raw File View Project SPDX
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
using System;

namespace antlr
{
	/*ANTLR Translator Generator
	* Project led by Terence Parr at http://www.jGuru.com
	* Software rights: http://www.antlr.org/license.html
	*
	* $Id:$
	*/

	//
	// ANTLR C# Code Generator by Micheal Jordan
	//                            Kunle Odutola       : kunle UNDERSCORE odutola AT hotmail DOT com
	//                            Anthony Oguntimehin
	//
	// With many thanks to Eric V. Smith from the ANTLR list.
	//

	/*A token is minimally a token type.  Subclasses can add the text matched
	*  for the token and line info. 
	*/

	public class Token : IToken //, ICloneable
	{
		// constants
		public const int MIN_USER_TYPE = 4;
		public const int NULL_TREE_LOOKAHEAD = 3;
		public const int INVALID_TYPE = 0;
		public const int EOF_TYPE = 1;
		public static readonly int SKIP = - 1;
		
		// each Token has at least a token type
		protected int type_;
		
		// the illegal token object
		public static Token badToken = new Token(INVALID_TYPE, "<no text>");
		
		public Token()
		{
			type_ = INVALID_TYPE;
		}
		public Token(int t)
		{
			type_ = t;
		}
		public Token(int t, string txt)
		{
			type_ = t;
			setText(txt);
		}
		public virtual int getColumn()
		{
			return 0;
		}
		public virtual int getLine()
		{
			return 0;
		}
		public virtual string getFilename() 
		{
			return null;
		}

		public virtual void setFilename(string name) 
		{
		}

		public virtual string getText()
		{
			return "<no text>";
		}

		public int Type
		{
			get { return type_;  }
			set { type_ = value; }
		}

		public virtual void setType(int newType)	{ this.Type = newType; }

		public virtual void  setColumn(int c)
		{
			;
		}
		public virtual void  setLine(int l)
		{
			;
		}
		public virtual void  setText(string t)
		{
			;
		}
		override public string ToString()
		{
			return "[\"" + getText() + "\",<" + type_ + ">]";
		}
	}
}
Back to Top