1 <?xml version="1.0" encoding="UTF-8"?>
4 ANT file for generating JFlex/CUP parsers.
6 If you want to add a new parser, you basically only need to do the
8 - write JFlex and CUP files, i.e., Parser.cup and Scanner.jflex, for your
9 parser and place them in a separated sub-package
10 - add an "antcall" to the "parsers" target, with the sub-package as parameter
11 (the sub-package your parser files reside in)
13 For an example, please refer to the "weka.core.mathematicalexpression" parser.
19 http://www2.cs.tum.edu/projects/cup/
21 Author: FracPete (fracpete at waikato dot ac dot nz)
22 Version: $Revision: 1.2 $
25 <project name="weka-parsers" default="compile" basedir=".">
26 <property name="build.compiler" value="modern" />
27 <property name="debug" value="on" />
28 <property name="deprecation" value="off" />
29 <property name="optimization" value="off" />
30 <property name="build" value="build"/>
31 <property name="lib" value="lib"/>
32 <property name="parserpkg" value="" />
33 <property name="src" value="src/main/java" />
35 <path id="project.class.path">
36 <fileset dir="${lib}">
37 <include name="*.jar"/>
38 <include name="*.zip"/>
40 <pathelement location="${build}/classes"/>
41 <pathelement path="${java.class.path}" />
44 <target name="init" description="Initializes the build environment.">
45 <!-- initialize Weka -->
46 <ant antfile="build.xml" target="init_compile"/>
49 <target name="compile" depends="init" description="Compiles Weka.">
51 <ant antfile="build.xml" target="compile"/>
52 <!-- generate parsers -->
53 <antcall target="parsers"/>
54 <!-- recompile Weka -->
55 <ant antfile="build.xml" target="compile"/>
58 <!-- central target for calling the parser targets -->
59 <target name="parsers" depends="init" description="Generates all the parsers subsequently.">
60 <antcall target="parser">
61 <param name="parserpkg" value="weka/core/mathematicalexpression"/>
63 <antcall target="parser">
64 <param name="parserpkg" value="weka/filters/unsupervised/instance/subsetbyexpression"/>
66 <antcall target="parser">
67 <param name="parserpkg" value="weka/core/json"/>
69 <!-- add calls for more parsers here -->
72 <!-- generates a parser situated in the ${parserpkg} sub-package
73 (using Parser.cup and Scanner.jflex). -->
74 <target name="parser" description="Generates the parser ${parserpkg}.">
75 <echo message="Generating lexer (${parserpkg})."/>
76 <java classname="JFlex.Main">
77 <classpath refid="project.class.path"/>
79 <arg value="--quiet"/>
80 <arg value="--nobak"/>
81 <arg value="--outdir"/>
82 <arg value="${src}/${parserpkg}"/>
83 <arg value="${src}/${parserpkg}/Scanner.jflex"/>
85 <echo message="Generating parser (${parserpkg})."/>
86 <java classname="java_cup.Main">
87 <classpath refid="project.class.path"/>
88 <arg value="-parser"/>
90 <arg value="-interface"/>
91 <arg value="-destdir"/>
92 <arg value="${src}/${parserpkg}"/>
93 <arg value="${src}/${parserpkg}/Parser.cup"/>