Howdy...jim's right. you need to know whence a token came sometimes.
updated C# and Java runtimes. CommonToken already had this ability so
i just added setters/getters and updated interface.
edit //depot/code/antlr/main/runtime/CSharp/Sources/Antlr3.Runtime/
Antlr.Runtime.Debug/RemoteDebugEventSocketListener.cs#2
edit //depot/code/antlr/main/runtime/CSharp/Sources/Antlr3.Runtime/
Antlr.Runtime/ClassicToken.cs#2
edit //depot/code/antlr/main/runtime/CSharp/Sources/Antlr3.Runtime/
Antlr.Runtime/CommonToken.cs#2
edit //depot/code/antlr/main/runtime/CSharp/Sources/Antlr3.Runtime/
Antlr.Runtime/Token.cs#2
edit //depot/code/antlr/main/runtime/Java/src/org/antlr/runtime/
ClassicToken.java#4
edit //depot/code/antlr/main/runtime/Java/src/org/antlr/runtime/
CommonToken.java#5
edit //depot/code/antlr/main/runtime/Java/src/org/antlr/runtime/
Token.java#6
edit //depot/code/antlr/main/runtime/Java/src/org/antlr/runtime/debug/
RemoteDebugEventSocketListener.java#11
Change 4711 submitted.
Ter
On Mar 23, 2008, at 4:17 PM, Jim Idle wrote:
> On Sun, 23 Mar 2008 13:42:37 -0700
> Terence Parr <[EMAIL PROTECTED]> wrote:
>> On Mar 12, 2008, at 5:07 PM, Jim Idle wrote:
>>> Yes – it would just not be there in the Token, just CommonToken
>>> and of course whatever anyone else wishes to derive from it. I
>>> already hacked it locally ;-)
>> Hmm...i'm reluctant to add another field to every token... can we
>> store that variable somewhere else? where do you need that pointer
>> again?
>>
>
> Well, the field ('input') is already there in common token, so we
> are just adding a method, getInput() that returns the input property
> that is already there. You could just make it a public property.
> Though that isn't strictly kosher, it is a read only property so...
>
> How I use it is that within ASTs, when doing semantic checks, I may
> have tokens from more than the one input stream, hence, to find out
> the originating source file, I want to find out where the token came
> from. Of course the CommonToken coudl be extended to provide that
> method, but as the property is already there, it makes send to have
> an accessor method for it I think?
>
> Jim
_______________________________________________
antlr-dev mailing list
[email protected]
http://www.antlr.org:8080/mailman/listinfo/antlr-dev