[antlr-interest] Exit Status from ANTLR
Randall R Schulz
rschulz at sonic.net
Mon Jun 25 14:15:31 PDT 2007
On Monday 25 June 2007 14:03, Randall R Schulz wrote:
> ...
>
> For the moment, I'm just hacking around it with grep, though I don't
> think it handles all the possible error cases. As I encounter them,
> I'll just add them to the grep patterns.
>
> -==--==--==--==--==-buildParser-==--==--==--==--==-
> #!/bin/bash --norc
>
>
> # Clean up old generated source and class files
> # [ elided ]
>
> # Run ANTLR
> antlr "$@" CLIF.g >|CLIF-err 2>&1
>
> if egrep -q '^(warning|error)' CLIF-err; then
> cat CLIF-err
> fi
>
> if egrep -v -q '^error' CLIF-err; then
> build CL
> fi
> -==--==--==--==--==-buildParser-==--==--==--==--==-
Just in case anyone wants to follow this approach, two things:
1) the last clause should be this:
if [ "$(egrep -L '^error' CLIF-err)" ] ; then
build CL
fi
2) The command "build CL" is actually an invocation of Ant.
> > cheers,
> > -k
Randall Schulz
More information about the antlr-interest
mailing list