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" <[email protected]> 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: [email protected] >[mailto:[email protected]] On Behalf Of Dejas Ninethousand >Sent: Thursday, September 08, 2011 11:59 AM >To: [email protected] >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 List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.
