[antlr-interest] For getCharPositionInLine(), is there a way to make tab count for 8 chars instead of 1?
Douglas Godfrey
douglasgodfrey at gmail.com
Tue Sep 13 01:35:35 PDT 2011
frontend Antlr with a preprocessing step that expands TAB characters to
the desired tab stop size
then pass the processed text to the lexer and all column positions will be
correct.
On 9/8/11 1:23 PM, "Sam Harwell" <sharwell at pixelminegames.com> wrote:
>I actually asked Dr. Parr recently about why the property is called
>CharPositionInLine instead of just Column. The name was actually picked to
>make it clear that tab and space are each treated as 1 character. When
>talking about parsing, the term "Column" also always refers to the
>character
>position within a line.
>
>The notion that the width of a tab is not equal to the width of a space
>is a
>UI concept independent of the parsing problem, and widely varies as you
>move
>from IDEs to word processors to typesetting systems. Whether it's called
>"CharPositionInLine" or "Column", the parser will provide consistent
>information about character positions and you'll need to independently
>implement the "width" of your tab characters as it applies to your
>particular target environment.
>
>Sam
>
>-----Original Message-----
>From: antlr-interest-bounces at antlr.org
>[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Dejas Ninethousand
>Sent: Thursday, September 08, 2011 11:59 AM
>To: antlr-interest at antlr.org
>Subject: [antlr-interest] For getCharPositionInLine(), is there a way to
>make tab count for 8 chars instead of 1?
>
>I want to ensure that line and cols reported by my parser line up with
>what
>the user would see in a program like Textpad. In Textpad if you move the
>cursor across a tab character the column counter and cursor advance by 8
>and
>not 1 even though only one char in the stream has been traversed. Can I
>configure some setting in ANTRL such that tab chars are treated the same
>way
>for column reporting?
>
>Thanks.
>
>List: http://www.antlr.org/mailman/listinfo/antlr-interest
>Unsubscribe:
>http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
>
>List: http://www.antlr.org/mailman/listinfo/antlr-interest
>Unsubscribe:
>http://www.antlr.org/mailman/options/antlr-interest/your-email-address
More information about the antlr-interest
mailing list