I am new in antlr too but will try to help if I can.
In the version of antlr (2.7.1) the column information works fine.
If I call getColumn() from a Token it gives the correct column and the
Lexer or Parser have done nothing special for that.
If you have an old version try to update antlr.
Neil Benn wrote:
> I'm very sorry to be posting so many questions, I'm afraid I
> have another. I'd also like to thank the people who have responded to
> I'm looking to obtain column and line information for the
> parser. I have line information sorted out but am confused with the
> column identification. Looking at the jdocs for the antlr package
> (2.7.0), the Token class has a getter/setter for Column. However
> calling this just results in a zero.
> Looking at the docs on the antlr documentation page, they seem
> to be out of date with my version as it talks about overriding consume
> and providing a getColumn method.
> The getColumn method is already there and looking at the FAQ
> asking the same thing - it says - 'do not override consume'.
> There is a comment later that I need to provide the input stream
> in binary mode. Therefore I have created a FileInputStream which
> obtains a stream of bytes and sent this in but to no avail the column
> number still sits at one.
> These conflicting statements have confused me slightly - please
> could you let me know the best way to provide column information on the
> location of a token.
> Thanks, once again for your assistance.
> Neil Benn
> Senior Automation Informatics Scientist
> Cambridge Antibody Technology
> The Science Park
> SG8 6JJ, UK
> Telephone: + 44 (0) 1763 263233
> Facsimile + 44 (0) 1763 263413
> Email: mailto:neil.benn@...
> Cambridge Antibody Technology Limited *
> Registered Office: The Science Park, Melbourn, Cambridgeshire, SG8 6JJ,
> UK Registered in England and Wales number 2451177
> (* Cambridge Antibody Technology Limited is a member of the Cambridge
> Antibody Technology Group of Companies)
> Confidentiality Note: This information and any attachments is
> confidential and only for use by the individual or entity to whom it has
> been sent. Any unauthorised dissemination, distribution or copying of
> this message is strictly prohibited. If you are not the intended
> recipient please inform the sender immediately by reply e-mail and
> delete this message from your system. Thank you for your co-operation.
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/