ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Gainty <mgai...@hotmail.com>
Subject RE: Problems with ANTLR
Date Thu, 10 Jun 2010 11:41:33 GMT

Good Afternoon
 
please download antlr3-task.zip source from http://www.antlr.org/share/1169924912745/antlr3-task.zip

unzip/uncompress to temp folder
in org.apache.tools.ant.antlr.ANTLR3.java
change
    public ANTLR3() {
        commandline.setVm(JavaEnvUtils.getJreExecutable("java"));
        //commandline.setClassname("org.antlr.Tool");  /* there is no org.antlr.Tool class
*/
        commandline.setClassname("antlr.Tool");
        fileUtils = FileUtils.getFileUtils();
    }
recompile

place org.apache.tools.ant.antlr.ANTLR3 in classpath

 

contents of ./classes/org/apache/tools/ant/ant/antlr/antlib.xml (first antlib.xml in classpath)
<?xml version="1.0" encoding="utf-8"?>

<antlib>

  <taskdef

    name="ant-antlr3"

    classname="org.apache.tools.ant.antlr.ANTLR3"

    />

</antlib>

 

and snippet from build.xml test test harness (from antlr3-task/simplecTreeParser.tp):
    <property name="m2.antlib.resource" value="."/>
    <property name="m2.antlib.uri" value="antlib:org/apache/tools/ant/antlr/ANTLR3"/>
    <macrodef name="antlr3">
       <attribute name="grammar" default="grammar"/>
       <attribute name="grammar.name" default="grammar"/>
       <attribute name="package" default="${package}"/>
       <sequential>
              <echo message="antlr ${grammar}/@{grammar.name}" />
              <antlr:ant-antlr3 xmlns:antlr="antlib:org/apache/tools/ant/antlr" 
                  target="${grammar}/@{grammar.name}" 
                  outputdirectory="${src}/@{package}"
                  libdirectory="${src}/@{package}"
                  multithreaded="${multithreaded}"
                  report="${report}"
                  depend="${depend}"
                  profile="${profile}">
              </antlr:ant-antlr3>
        </sequential>
    </macrodef>
    
    <target name="SimpleC" depends="init" >
       <antlr3 grammar.name="SimpleC.g" />
    </target>

 

ant -debug SimpleC 

will explain the workings

 

Juergen can you correct the codebase for antlr.Tool to refactor to org.antlr.Tool so org.apache.tools.ant.antlr.ANTLR3
test harness runs correctly w/o modification from above?

 

Vielen Danke,
Martin  
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten
wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist
unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet
keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen
wir keine Haftung fuer den Inhalt uebernehmen.

 

> Date: Wed, 9 Jun 2010 13:40:22 -0700
> From: nlaparo@yahoo.com
> To: user@ant.apache.org
> Subject: RE: Problems with ANTLR
> 
> 
> 1) I downloaded the antlr3-task.zip today from the antlr home page.
> 2) In the zip is a jar called antlr3_task.jar
> 3) I copied antlr3_task.jar to my eclipse ant plugin lib directory,
> C:\eclipse\plugins\org.apache.ant_1.7.1.v20090120-1145\lib
> 4) I put this in my build.xml:
> <antlr:antlr3 xmlns:antlr="antlib:org/apache/tools/ant/antlr"
> target="${src.etc.dir}/parser/catos.g"
> outputdirectory="${target.gen.java.dir}/${target.antlr.parser.dir}">
> <classpath refid="compile.classpath"/>
> </antlr:antlr3>
> 
> 4) When I build I get:
> BUILD FAILED
> C:\workspace\ess-networking\build.xml:41: Problem: failed to create task or
> type antlib:org/apache/tools/ant/antlr:antlr3
> Cause: The name is undefined.
> Action: Check the spelling.
> Action: Check that any custom tasks/types have been declared.
> Action: Check that any <presetdef>/<macrodef> declarations have taken place.
> No types or tasks have been defined in this namespace yet
> 
> This appears to be an antlib declaration. 
> Action: Check that the implementing library exists in one of:
> -C:\eclipse\plugins\org.apache.ant_1.7.1.v20090120-1145\lib
> -C:\Documents and Settings\nlaparo\.ant\lib
> -a directory added on the command line with the -lib argument
> 
> # wrote:
> > 
> > Hi,
> > 
> > the ant-lib for the antlr3 task can be downloaded from here: 
> > http://antlr.org/share/1169924912745/antlr3-task.zip
> > A short description of it's usage is enclosed in the zip-archive
> > (antlr3-task.htm or antlr3-task.doc).
> > Try the examples contained in the zip-archive. There is also an example on
> > how to use the antlr3 task for ant in netbeans.
> > If you still have questions, I will try to answer them.
> > 
> > Kind regards, J├╝rgen
> > 
> 
> -- 
> View this message in context: http://old.nabble.com/Problems-with-ANTLR-tp23287211p28835592.html
> Sent from the Ant - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
 		 	   		  
_________________________________________________________________
The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message