[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problem with lexer.dat



Hi-

On Thu, 6 Jun 2002 Marco.Cantagallo@alcatel.fr wrote:

> Date: Thu, 6 Jun 2002 11:59:36 +0200
> From: Marco.Cantagallo@alcatel.fr
> To: sablecc-list@sable.mcgill.ca
> Subject: problem with lexer.dat 
> 
> Hi all, 
>  
> Since some days I'm using sablecc to produce a small compiler. 
> I experienced the following problem: if the target directory of the
> compiled classes is different from the sources' directory, the lexer.dat
> file is reported as corrupted or missing, even after it has moved to the
> classes directory. ...

   I use ant to execute my builds.  I have included an ant file below
which "does the right thing".  I'm not sure if you can infer from it
how to configure JBuilder correctly, since I'm not familiar with
JBuilder, but hopefully this will be of some use.  The important thing
to notice is that if you build a jar file correctly, the .dat file
problem doesn't surface.  FYI, ant is a jakarta build tool (see
<http://jakarta.apache.org/ant/>).

   Basically, I organize my directories like this:

      pre -   holds the sablecc spec
      src -   holds source I've hand coded
      gen -   holds source sablecc produces
      build - holds classes from "src" and "gen" (result of javac)
      lib -   holds jar from "build", plus the relevant .dat's

   So, you may want to see if you can adapt the code in the "jars"
target to the JBuilder environment.  Good luck.

-Peter J. Nuernberg
 Department of Computer Science, Aalborg University Esbjerg
 http://www.cs.aue.auc.dk/~pnuern/

--- cut here ---

<?xml version="1.0"?>
<project name="Construct Service Generator" default="dev.jar" basedir=".">

   <taskdef name="sablecc" classname="org.sablecc.ant.taskdef.Sablecc" />

   <property file="build.properties"/>

   <!-- many irrelevant targets omitted -->

   <!-- build jars -->
   <target name="jars" description="build jar file">
      <jar jarfile="${lib.dir}/${csg.abbrv}-${csg.ver}-${XDSTAMP}.jar">
         <fileset dir="${build.dir}"/>
         <fileset dir="${gensrc.dir}" includes="**/*.dat"/>
      </jar>
      <copy file="${lib.dir}/${csg.abbrv}-${csg.ver}-${XDSTAMP}.jar"
         tofile="${lib.dir}/${csg.abbrv}-${csg.ver}.jar"/>
   </target>

   <!-- PARSER -->
   <target name="parser" depends="init,parser.bytecode"
      description="build parser"/>

   <!-- build parser bytecode -->
   <target name="parser.bytecode" description="build parser bytecode">
      <javac srcdir="${gensrc.dir}" destdir="${build.dir}">
         <classpath refid="full.classpath"/>
      </javac>
   </target>

   <!-- build parser sourcecode -->
   <target name="parser.sourcecode" depends="init"
      description="build parser sourcecode">
      <sablecc src="${pre.dir}" outputdirectory="${gensrc.dir}">
         <include name="idl-grammar.scc"/>
      </sablecc>
   </target>

   <!-- many irrelevant targets omitted -->

   <!-- clean rebuildable files -->
   <target name="realclean" depends="clean"
      description="remove intermediate and target files">
      <delete dir="${gensrc.dir}"/>
      <delete dir="${lib.dir}"/>
      <delete dir="${apidocs.dir}"/>
      <delete dir="${testdocs.dir}"/>
   </target>

</project>