[antlr-interest] column info for syntactic predicates

Oliver Burn oliver-lists at puppycrawl.com
Thu Sep 19 00:14:32 PDT 2002


FYI - Monty provided the solution to my problem. I needed to add the
following code to my Custom AST class:

    public void initialize(AST t) 
    {
        setText(t.getText());
        setType(t.getType());
        mLineNo = ((DetailAST) t).getLineNo();
        mColumnNo = ((DetailAST) t).getColumnNo();
    }

Then the line numbers will show up. He also explained that syntactic
predicates can't know about line numbers or columns, but semantic
predicates can.

Thanks Monty!

Regards,
Oliver

> -----Original Message-----
> From: Oliver Burn [mailto:oliver-lists at puppycrawl.com]
> Sent: Tuesday, 17 September 2002 09:48
> To: antlr-interest at yahoogroups.com
> Subject: RE: [antlr-interest] column info for syntactic predicates
> 
> 
> Hi Joe,
> 
> Still hoping for a solution to tracking column info for syntactic predicates.
> 
> Yes, the output from ANTLR certainly does not conform to the SUN coding
> standards. The trick when running Checkstyle using the ANT task is to
> exclude the generated ANTLR files.  The following is an example of how to
> do this. Note that the generated ANTLR files are prefixed with "Generated".
> 
>     <checkstyle properties="docs/checkstyle.rules">
>       <fileset dir="src/checkstyle"
>                includes="**/*.java"
>                excludes="**/Generated*.java"/>
>     </checkstyle>
> 
> Regards,
> Oliver
> 
> > -----Original Message-----
> > From: Joe Comuzzi [mailto:jcomuzzi at novell.com]
> > Sent: Tuesday, 17 September 2002 01:53
> > To: oliver-lists at puppycrawl.com; antlr-interest at yahoogroups.com
> > Subject: Re: [antlr-interest] column info for syntactic predicates
> > 
> > 
> > Oliver,
> > 
> >     I'll defer to Monty on the question of how to track columns even in
> > the presece of syntactic predicates, but  I've got a quick question for
> > you.
> > 
> >     First let me say we downloaded checkstyle and it works great! We're
> > going to use it as part of our build - but we've run into one
> > awkwardness. The output of ANTLR doesn't conform to the Sun coding
> > standard (Gee, what a surprise! :-)  Now we could hack around this by
> > putting all our grammars (and hence the generated .java) in a separate
> > directory but our code isn't currently structured like that. Do you face
> > this problem? What do you do?
> > 
> > Thanks,
> > 
> > Joe C.
> > 
> > >>> oliver-lists at puppycrawl.com 09/15/02 12:55AM >>>
> > Hi,
> > 
> > I am the author of a tool called Checkstyle (http://checkstyle.sf.net)
> > which
> > checks that Java code confirms to a coding standard. By default the Sun
> > coding
> > standard. The tool makes extensive use of ANTLR.
> > 
> > I am in the process of refactoring the way Checkstyle works, and want
> > to track
> > line & column information in syntactic predicates. In my research I
> > came across
> > the article on tracking column information at
> > http://www.antlr.org/fieldguide/columns/index.html.
> > 
> > At the end of the article it says that is it possible to track column
> > info for
> > syntactic predicates. Does anybody have any more information (or better
> > still
> > examples) on how to do this.
> > 
> > Regards,
> > Oliver
> > 
> >  
> > 
> > Your use of Yahoo! Groups is subject to
> > http://docs.yahoo.com/info/terms/ 
> > 
> 
>  
> 
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 
> 
> 

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list