Last change
on this file since 1 was
1,
checked in by lnalod, 15 years ago
|
Initial import of YAO sources
|
File size:
1.1 KB
|
Line | |
---|
1 | namespace antlr |
---|
2 | { |
---|
3 | /* ANTLR Translator Generator |
---|
4 | * Project led by Terence Parr at http://www.jGuru.com |
---|
5 | * Software rights: http://www.antlr.org/license.html |
---|
6 | */ |
---|
7 | |
---|
8 | // |
---|
9 | // ANTLR C# Code Generator by Micheal Jordan |
---|
10 | // Kunle Odutola : kunle UNDERSCORE odutola AT hotmail DOT com |
---|
11 | // Anthony Oguntimehin |
---|
12 | // |
---|
13 | |
---|
14 | using System; |
---|
15 | |
---|
16 | /// <summary> |
---|
17 | /// This token tracks it's own index 0..n-1 relative to the beginning |
---|
18 | /// of the stream. It is designed to work with |
---|
19 | /// <see cref="TokenStreamRewriteEngine"/> in TokenStreamRewriteEngine.cs |
---|
20 | /// </summary> |
---|
21 | public class TokenWithIndex : CommonToken |
---|
22 | { |
---|
23 | /// <summary> |
---|
24 | /// Index into token array indicating position in input stream |
---|
25 | /// </summary> |
---|
26 | int index; |
---|
27 | |
---|
28 | public TokenWithIndex() : base() |
---|
29 | { |
---|
30 | } |
---|
31 | |
---|
32 | public TokenWithIndex(int i, string t) : base(i, t) |
---|
33 | { |
---|
34 | } |
---|
35 | |
---|
36 | public void setIndex(int i) |
---|
37 | { |
---|
38 | index = i; |
---|
39 | } |
---|
40 | |
---|
41 | public int getIndex() |
---|
42 | { |
---|
43 | return index; |
---|
44 | } |
---|
45 | |
---|
46 | public override string ToString() |
---|
47 | { |
---|
48 | return "["+index+":\"" + getText() + "\",<" + Type + ">,line=" + line + ",col=" + col + "]\n"; |
---|
49 | } |
---|
50 | } |
---|
51 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.