ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ernst Reissner <rei3...@arcor.de>
Subject Re: AW: AW: Problems with ANTLR
Date Tue, 20 Aug 2013 08:34:18 GMT
Hi Matt,
thanks: one step further!
I tried now


   <path id="antlr.classpath">
     <fileset dir="${basedir}/jars">
       <include name="ant-antlr3.jar"/>
       <include name="antlr-3.5-complete.jar"/>
     </fileset>
   </path>

   <taskdef name="ant-antlr3"
        classname="org.apache.tools.ant.antlr.ANTLR3"
        classpathref="antlr.classpath"/>

   <target name="genParser" depends="init"
           description="Generate parsers. ">

     <ant-antlr3 target="${parserDirRelana}/CClass.g"
         outputdirectory="${parserTargetDirRelana}"
         verbose="true" >
        <classpath refid="antlr.classpath"/>
     </ant-antlr3>
...

It seems to create parsers only when grammar changed, so it is ok, but:
it is very slow: 11 secs if no parser is created and 30 if grammars are
created.
So a large portion of time goes into actions i cannot understand.
Whats the point here??

As you can see, i added the attribute verbose="true" because otherwise,
the task does not display the grammer it works on.

You gave me the hint, that the name of the task i defined is ant-antlr3.
I had a look at ant-doc "Writing Your Own Task" at
http://ant.apache.org/manual/develop.html.
Well they have forgotten to mention where the taskname comes from.
Is it the name of the defining jar?
or is it defined by the file org/apache/tools/ant/antlr/antlib.xml in
the jar which looks like this:


<?xml version="1.0" encoding="utf-8"?>
  <antlib>
    <taskdef   name="ant-antlr3"   
classname="org.apache.tools.ant.antlr.ANTLR3"    />
  </antlib>



When I run the task however the output indicates a problem:

genParser:
[ant-antlr3] Failed to change file modification time
[ant-antlr3] ANTLR Parser Generator  Version 3.5
[ant-antlr3]
/home/ernst/Software/src/main/antlr3/eu/simuline/relana/parser/CClass.g
[ant-antlr3] Failed to change file modification time
[ant-antlr3]
/home/ernst/Software/src/main/antlr3/eu/simuline/relana/parser/SClass.g
[ant-antlr3] ANTLR Parser Generator  Version 3.5
[ant-antlr3] Failed to change file modification time
[ant-antlr3] ANTLR Parser Generator  Version 3.5
[ant-antlr3]
/home/ernst/Software/src/main/antlr3/eu/simuline/relana/parser/Formula.g
[ant-antlr3] Failed to change file modification time

The message: Failed to change file modification time seems to belong to
the touch task.
I really cannot figure out which file could me meant.
This message comes even if no parser is defined yet.

greetings,
Ernst

> See inline for some commentary:
>
>
> On Mon, Aug 19, 2013 at 2:28 AM, Ernst Reissner <[hidden email]
> </user/SendEmail.jtp?type=node&node=5714362&i=0>> wrote:
>
> > Ok, got one step further:
> > now i have:
> >
> >    <path id="antlr.classpath">
> >      <fileset dir="${basedir}/jars">
> >        <include name="ant-antlr3.jar"/>
> >      </fileset>
> >    </path>
> >
> >
> Here you define the task as being named "ant-antlr3":
>
>
> >    <taskdef name="ant-antlr3"
> >         classname="org.apache.tools.ant.antlr.ANTLR3"
> >         classpathref="antlr.classpath"/>
> >
> > which seems to work.
> >
> > But when i try to use the new task by
> >
> >
> Here you try use a task named "antlr", which is the ANTLR v2 task that
> has
> shipped with Ant prior to the release of ANTLRv3 and before the Ant PMC
> began to push for third parties managing their own Ant tasks rather than
> Ant trying to provide them all:
>
>
> >      <antlr target="${parserDirRelana}/CClass.g"
> >         outputdirectory="${parserTargetDirRelana}">
> >         <classpath refid="antlr.classpath"/>
> >      </antlr>
> >
> > ant complaints
> >
> > ernst@localhost:~/Software> ant genParser
> > Buildfile: /home/ernst/Software/build.xml
> >
> > init:
> >
> > genParser:
> >
> > BUILD FAILED
> > /home/ernst/Software/build.xml:377: Unable to determine generated class
> >
> > Total time: 0 seconds
> >
> > Who can tell me what this means, and even better: what to do now.
> >
>
> Don't try to use ANTLR 2 on a v3 grammar.  ;P
>
> Matt
>
>
> > Ernst
> >
> >
> > > Hi Jan,
> > > i tried
> > >>   <taskdef
> > >>     name="ant-antlr3"
> > >>     classname="org.apache.tools.ant.antlr.ANTLR3"
> > >>     />
> > > as you suggested (which looks much better than what i did before).
> > > Result
> > >
> > > ernst@localhost:~/Software> ant genParser
> > > Buildfile: /home/ernst/Software/build.xml
> > >
> > > BUILD FAILED
> > > /home/ernst/Software/build.xml:360: taskdef class
> > > org.apache.tools.ant.antlr.ANTLR3 cannot be found
> > >  using the classloader AntClassLoader[]
> > >
> > > I am very confused about that, because i integrated ant-antlr3.jar
> the
> > > same way
> > > suse distribution integrated ant-antlr.jar and other taskdefs.
> > >
> > > As I wrote before, ant -diagnostics yields
> > > ------- Ant diagnostics report -------
> > > Apache Ant(TM) version 1.8.2 compiled on January 27 2013
> > >
> > > -------------------------------------------
> > >  Implementation Version
> > > -------------------------------------------
> > > core tasks     : 1.8.2 in file:/usr/share/java/ant.jar
> > >
> > > ...
> > > -------------------------------------------
> > >  ANT_HOME/lib jar listing
> > > -------------------------------------------
> > > ant.home: /usr/share/ant
> > > ant-jmf.jar (6709 bytes)
> > > ant-bootstrap.jar (19876 bytes)
> > > ant-junit.jar (102344 bytes)
> > > ant.jar (1963225 bytes)
> > > ant-jsch.jar (40235 bytes)
> > > ant-launcher.jar (12433 bytes)
> > > ant-javamail.jar (7959 bytes)
> > > ant-testutil.jar (15194 bytes)
> > > ant-antlr3.jar (20889 bytes)
> > > ant-jdepend.jar (8221 bytes)
> > > ant-antlr.jar (5750 bytes)
> > > ant-swing.jar (7547 bytes)
> > >
> > > -------------------------------------------
> > >  USER_HOME/.ant/lib jar listing
> > > -------------------------------------------
> > > user.home: /home/ernst
> > > No such directory.
> > >
> > >
> > > as you can see, ant-antlr3.jar (20889 bytes) is present.
> > > Also:
> > > java.class.path :
> > >
> >
> /usr/share/java/ant.jar:/usr/share/java/ant-launcher.jar:/usr/share/java/jaxp_parser_impl.jar:/usr/share/java/xml-commons-apis.jar:
> > > /usr/share/java/antlr.jar:
> > >
> >
> /usr/share/java/ant/ant-antlr.jar:/usr/share/java/ant/ant-javamail.jar:/usr/share/java/jdepend.jar:/usr/share/java/ant/ant-jdepend.jar:/usr/share/java/ant/ant-jmf.jar:/usr/share/java/jsch.jar:/usr/share/java/ant/ant-jsch.jar:/usr/share/java/junit.jar:/usr/share/java/ant/ant-junit.jar:/usr/share/java/ant/ant-swing.jar:/usr/share/java/ant/ant-testutil.jar:/usr/lib64/jvm/java/lib/tools.jar:/usr/share/ant/lib/ant-jmf.jar:/usr/share/ant/lib/ant-bootstrap.jar:/usr/share/ant/lib/ant-junit.jar:/usr/share/ant/lib/ant.jar:/usr/share/ant/lib/ant-jsch.jar:/usr/share/ant/lib/ant-launcher.jar:/usr/share/ant/lib/ant-javamail.jar:/usr/share/ant/lib/ant-testutil.jar:
> > > /usr/share/ant/lib/ant-antlr3.jar:
> > >
> >
> /usr/share/ant/lib/ant-jdepend.jar:/usr/share/ant/lib/ant-antlr.jar:/usr/share/ant/lib/ant-swing.jar
> > >
> > > I am not an expert, but it looks fine for me.
> > >
> > > What could be the problem?
> > >
> > > Ernst
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> >
> >
> >
> > --
> > View this message in context:
> >
> http://ant.1045680.n5.nabble.com/Problems-with-ANTLR-tp1349074p5714358.html
> > Sent from the Ant - Users mailing list archive at Nabble.com.
> >
>
>
> ------------------------------------------------------------------------
> If you reply to this email, your message will be added to the
> discussion below:
> http://ant.1045680.n5.nabble.com/Problems-with-ANTLR-tp1349074p5714362.html
>
> To unsubscribe from Problems with ANTLR, click here
> <http://ant.1045680.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=1349074&code=cmVpM25lckBhcmNvci5kZXwxMzQ5MDc0fDExODQzMjAw>.
> NAML
> <http://ant.1045680.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>





--
View this message in context: http://ant.1045680.n5.nabble.com/Problems-with-ANTLR-tp1349074p5714365.html
Sent from the Ant - Users mailing list archive at Nabble.com.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message