File: ParserMatchEventArgs.cs

package info (click to toggle)
antlr 2.7.7%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 9,920 kB
  • sloc: java: 54,649; cs: 12,533; makefile: 8,963; cpp: 7,359; pascal: 5,273; sh: 4,337; python: 4,301; lisp: 1,969; xml: 220; lex: 192; ansic: 134
file content (93 lines) | stat: -rwxr-xr-x 2,064 bytes parent folder | download | duplicates (15)
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
namespace antlr.debug
{
	using System;
	
	public class MatchEventArgs : GuessingEventArgs
	{
		public MatchEventArgs()
		{
		}
		public MatchEventArgs(int type, int val, object target, string text, int guessing, bool inverse, bool matched)
		{
			setValues(type, val, target, text, guessing, inverse, matched);
		}

		public virtual object Target
		{
			get	{ return this.target_;	}
			set	{ this.target_ = value;	}
		}

		public virtual string Text
		{
			get	{ return this.text_;	}
			set	{ this.text_ = value;	}
		}

		public virtual int Value
		{
			get	{ return this.val_;		}
			set	{ this.val_ = value;	}
		}

		internal bool Inverse
		{
			set	{ this.inverse_ = value;	}
		}

		internal bool Matched
		{
			set	{ this.matched_ = value;	}
		}

		// NOTE: for a mismatch on type STRING, the "text" is used as the lookahead
		//       value.  Normally "value" is this
		public enum ParserMatchEnums
		{
			TOKEN		= 0,
			BITSET		= 1,
			CHAR		= 2,
			CHAR_BITSET = 3,
			STRING		= 4,
			CHAR_RANGE	= 5,
		}
		public static int TOKEN = 0;
		public static int BITSET = 1;
		public static int CHAR = 2;
		public static int CHAR_BITSET = 3;
		public static int STRING = 4;
		public static int CHAR_RANGE = 5;

		private bool	inverse_;
		private bool	matched_;
		private object	target_;
		private int		val_;
		private string	text_;
		
		
		public virtual bool isInverse()
		{
			return inverse_;
		}
		public virtual bool isMatched()
		{
			return matched_;
		}
		/// <summary>This should NOT be called from anyone other than ParserEventSupport! 
		/// </summary>
		internal void  setValues(int type, int val, object target, string text, int guessing, bool inverse, bool matched)
		{
			base.setValues(type, guessing);
			this.Value = val;
			this.Target = target;
			this.Inverse = inverse;
			this.Matched = matched;
			this.Text = text;
		}
		
		public override string ToString()
		{
			return "ParserMatchEvent [" + (isMatched()?"ok,":"bad,") + (isInverse()?"NOT ":"") + (Type == TOKEN?"token,":"bitset,") + Value + "," + Target + "," + Guessing + "]";
		}
	}
}