[antlr-interest] ANTLR v3.1.1 released

Randall R Schulz rschulz at sonic.net
Tue Oct 21 11:52:52 PDT 2008


On Tuesday 21 October 2008 11:44, Terence Parr wrote:
> On Oct 21, 2008, at 11:41 AM, Randall R Schulz wrote:
> > On Tuesday 21 October 2008 11:36, Terence Parr wrote:
> >> Hi Randall, I see
> >>
> >> 	public static void main(String[] args) {
> >> 		ErrorManager.info("ANTLR Parser Generator  Version " +
> >> 						  VERSION); // + " (August 12, 2008)  1989-2008");
> >> 		Tool antlr = new Tool(args);
> >> 		antlr.process();
> >> 		if ( ErrorManager.getNumErrors() > 0 ) {
> >> 			System.exit(1);
> >> 		}
> >> 		System.exit(0);
> >> 	}
> >>
> >> in Tool.  It calls exit(1) upon syntax.  Which error didn't return
> >> 1 for you?
> >
> > Well, during my most recent parser development (when I sent that),
> > I naturally had many errors along the way and never got an exit
> > status other than 0
> >
> >> Ter
> >
> > Randall Schulz
>
> It's hard to see a code trace that could given an error (not warning)
> that wouldn't be trapped here.  Hmm...ok, let me know if you find a
> future issue.
>
> Ter

From the 3.1.1 source:

-==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-
    public static ErrorState getErrorState() {
        ErrorState ec =
            (ErrorState)threadToErrorStateMap.get(Thread.currentThread());
        if ( ec==null ) {
            ec = new ErrorState();
            threadToErrorStateMap.put(Thread.currentThread(), ec);
        }
        return ec;
    }

    public static int getNumErrors() {
        return getErrorState().errors;
    }
-==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-


Perhaps its some kind of thread issue / mix-up?


Randall Schulz


More information about the antlr-interest mailing list