Add a port of jflex:

JFlex is a lexical analyzer generator for Java written in Java.
It is also a rewrite of the very useful tool JLex which was developed
by Elliot Berk at Princeton University. As Vern Paxon states for his C/C++
tool flex: They do not share any code though.

WWW: http://www.jflex.de/

I've done some clean up to the submitted version of the port.

PR:		62043
Submitted by:	Conor McDermottroe <ports@mcdermottroe.com>
This commit is contained in:
Greg Lewis 2004-02-18 19:50:33 +00:00
parent 498d5c10eb
commit a69622a594
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=101341
7 changed files with 219 additions and 0 deletions

View File

@ -72,6 +72,7 @@
SUBDIR += jdk14-doc
SUBDIR += jdom
SUBDIR += jfc
SUBDIR += jflex
SUBDIR += jfreechart
SUBDIR += jikes
SUBDIR += jlex

46
java/jflex/Makefile Normal file
View File

@ -0,0 +1,46 @@
# Ports collection Makefile for: JFlex
# Date created: 27 January 2004
# Whom: Conor McDermottroe <ports@mcdermottroe.com>
#
# $FreeBSD$
#
PORTNAME= jflex
PORTVERSION= 1.3.5
CATEGORIES= java devel
MASTER_SITES= http://www.jflex.de/
MAINTAINER= ports@mcdermottroe.com
COMMENT= The Fast Lexical Analyser Generator for Java[tm]
USE_JAVA= 1.1+
NEED_JAVAC= yes
USE_REINPLACE= yes
WRKSRC= ${WRKDIR}/JFlex
BUILD_WRKSRC= ${WRKSRC}/src
MAKE_ENV+= JAVAC="${JAVAC}" JAR="${JAR}" JAVAJARDIR="${JAVAJARDIR}" \
JAVA_CLASSES="${JAVA_CLASSES}"
PLIST_SUB= JAVAJARDIR=${JAVAJARDIR:S|^${PREFIX}/||}
.if !defined(NOPORTDOCS)
PORTDOCS= *
.endif
do-configure:
@${REINPLACE_CMD} -e 's|%%JAVAJARDIR%%|${JAVAJARDIR}|' \
${WRKSRC}/bin/jflex
do-install:
@${INSTALL_SCRIPT} ${WRKSRC}/bin/jflex ${PREFIX}/bin/jflex
@${INSTALL_DATA} ${WRKSRC}/lib/JFlex.jar ${JAVAJARDIR}/JFlex.jar
.if !defined(NOPORTDOCS)
${MKDIR} ${DOCSDIR}
${INSTALL_DATA} ${WRKSRC}/doc/* ${DOCSDIR}
.endif
${MKDIR} ${EXAMPLESDIR}
.for EXAMPLE in binary byaccj cup interpreter java simple standalone
${MKDIR} ${EXAMPLESDIR}/${EXAMPLE}
${INSTALL_DATA} ${WRKSRC}/examples/${EXAMPLE}/* ${EXAMPLESDIR}/${EXAMPLE}
.endfor
.include <bsd.port.mk>

2
java/jflex/distinfo Normal file
View File

@ -0,0 +1,2 @@
MD5 (jflex-1.3.5.tar.gz) = c77a9656aa20979f2268d7443995700f
SIZE (jflex-1.3.5.tar.gz) = 799903

View File

@ -0,0 +1,29 @@
--- src/Makefile.orig Mon Oct 8 03:57:06 2001
+++ src/Makefile Wed Feb 18 12:30:44 2004
@@ -1,23 +1,21 @@
# you need JFlex 1.2.2 and CUP 0.10j or later for this Makefile to work
JFLEX = jflex -skel skeleton.nested
-CUP = java java_cup.Main
+CUP = java -classpath ${JAVAJARDIR}/java_cup.jar java_cup.Main
-JAVAC = javac -target 1.1 -bootclasspath /usr/lib/jdk1.1/lib/classes.zip
#JAVAC = jikes
-JAR = jar
DEST = ../lib
# jdk 1.2
-CLPATH = -classpath /usr/lib/java/jre/lib/rt.jar:.
+CLPATH = -classpath ${JAVA_CLASSES}:.
# jdk 1.1
#CLPATH = -classpath /usr/lib/java/lib/classes.zip:.
# ------------------------------------------------------------
-JAVAC_FLAGS =
+JAVAC_FLAGS = -target 1.1
JARFILE = JFlex.jar

View File

@ -0,0 +1,71 @@
--- bin/jflex.orig Mon Oct 1 04:18:48 2001
+++ bin/jflex Wed Feb 18 12:19:00 2004
@@ -1,51 +1,19 @@
-#! /bin/bash
+#!/bin/sh
#
-# JFlex start script $Revision: 1.16 $
-#
-# if Java is not in your binary path, you need to supply its
-# location in this script. The script automatically finds
-# JFLEX_HOME when called directly, via binary path, or symbolic
-# link.
-#
-# Site wide installation: simply make a symlink from e.g.
-# /usr/bin/jflex to this script at its original position
-#
-#===================================================================
-#
-# configurables:
-
-# path to the java interpreter
-JAVA=java
-
-# end configurables
-#
-#===================================================================
-#
-
-# calculate true location
-
-PRG=`type $0`
-PRG=${PRG##* }
-
-# If PRG is a symlink, trace it to the real home directory
-
-while [ -L "$PRG" ]
-do
- newprg=$(ls -l ${PRG})
- newprg=${newprg##*-> }
- [ ${newprg} = ${newprg#/} ] && newprg=${PRG%/*}/${newprg}
- PRG="$newprg"
-done
-
-PRG=${PRG%/*}
-JFLEX_HOME=${PRG}/..
-
-# --------------------------------------------------------------------
-
-export CLASSPATH
-CLASSPATH=$JFLEX_HOME/lib/JFlex.jar
-
-$JAVA JFlex.Main $@
+# Replacement for the script that came with JFlex
+# because bash is not necessarily on a FreeBSD
+# machine. Also, we know where the jar is.
+#
+# Conor McDermottroe <ports@mcdermottroe.com>
+
+# Allow the user to override where JFlex.jar lives
+if [ -z "$JAVAJARDIR" ]; then
+ JAVAJARDIR=%%JAVAJARDIR%%
+fi
+
+# Allow the user to specify which java interpreter to use
+if [ -z "$JAVA" ]; then
+ JAVA="`which javavm`"
+fi
-#for more memory:
-#$JAVA -Xmx128m JFlex.Main $@
+$JAVA -jar $JAVAJARDIR/JFlex.jar $@

6
java/jflex/pkg-descr Normal file
View File

@ -0,0 +1,6 @@
JFlex is a lexical analyzer generator for Java written in Java.
It is also a rewrite of the very useful tool JLex which was developed
by Elliot Berk at Princeton University. As Vern Paxon states for his C/C++
tool flex: They do not share any code though.
WWW: http://www.jflex.de/

64
java/jflex/pkg-plist Normal file
View File

@ -0,0 +1,64 @@
bin/jflex
%%JAVAJARDIR%%/JFlex.jar
%%EXAMPLESDIR%%/binary/Makefile
%%EXAMPLESDIR%%/binary/README
%%EXAMPLESDIR%%/binary/StraightStreamReader.java
%%EXAMPLESDIR%%/binary/binary.flex
@dirrm %%EXAMPLESDIR%%/binary
%%EXAMPLESDIR%%/byaccj/Makefile
%%EXAMPLESDIR%%/byaccj/README
%%EXAMPLESDIR%%/byaccj/calc.flex
%%EXAMPLESDIR%%/byaccj/calc.y
@dirrm %%EXAMPLESDIR%%/byaccj
%%EXAMPLESDIR%%/cup/Main.java
%%EXAMPLESDIR%%/cup/Makefile
%%EXAMPLESDIR%%/cup/README
%%EXAMPLESDIR%%/cup/lcalc.flex
%%EXAMPLESDIR%%/cup/output.good
%%EXAMPLESDIR%%/cup/test.txt
%%EXAMPLESDIR%%/cup/ycalc.cup
@dirrm %%EXAMPLESDIR%%/cup
%%EXAMPLESDIR%%/interpreter/AST.java
%%EXAMPLESDIR%%/interpreter/Main.java
%%EXAMPLESDIR%%/interpreter/Makefile
%%EXAMPLESDIR%%/interpreter/README
%%EXAMPLESDIR%%/interpreter/STEfun.java
%%EXAMPLESDIR%%/interpreter/STEvar.java
%%EXAMPLESDIR%%/interpreter/SymTab.java
%%EXAMPLESDIR%%/interpreter/SymtabEntry.java
%%EXAMPLESDIR%%/interpreter/Tboolexp.java
%%EXAMPLESDIR%%/interpreter/Tdekl.java
%%EXAMPLESDIR%%/interpreter/Tdekllist.java
%%EXAMPLESDIR%%/interpreter/Texp.java
%%EXAMPLESDIR%%/interpreter/Texpinfix.java
%%EXAMPLESDIR%%/interpreter/Texplist.java
%%EXAMPLESDIR%%/interpreter/Tfun.java
%%EXAMPLESDIR%%/interpreter/Tident.java
%%EXAMPLESDIR%%/interpreter/Tifthenelse.java
%%EXAMPLESDIR%%/interpreter/Tnumber.java
%%EXAMPLESDIR%%/interpreter/Tparlist.java
%%EXAMPLESDIR%%/interpreter/Tprogram.java
%%EXAMPLESDIR%%/interpreter/Tuminus.java
%%EXAMPLESDIR%%/interpreter/example.as
%%EXAMPLESDIR%%/interpreter/parser.cup
%%EXAMPLESDIR%%/interpreter/scanner.flex
@dirrm %%EXAMPLESDIR%%/interpreter
%%EXAMPLESDIR%%/java/JavaParser.java
%%EXAMPLESDIR%%/java/JavaSymbol.java
%%EXAMPLESDIR%%/java/Makefile
%%EXAMPLESDIR%%/java/README
%%EXAMPLESDIR%%/java/java.flex
%%EXAMPLESDIR%%/java/java12.cup
%%EXAMPLESDIR%%/java/unicode.flex
@dirrm %%EXAMPLESDIR%%/java
%%EXAMPLESDIR%%/simple/README
%%EXAMPLESDIR%%/simple/Utility.java
%%EXAMPLESDIR%%/simple/Yytoken.java
%%EXAMPLESDIR%%/simple/simple.flex
@dirrm %%EXAMPLESDIR%%/simple
%%EXAMPLESDIR%%/standalone/Makefile
%%EXAMPLESDIR%%/standalone/README
%%EXAMPLESDIR%%/standalone/sample.inp
%%EXAMPLESDIR%%/standalone/standalone.flex
@dirrm %%EXAMPLESDIR%%/standalone
@dirrm %%EXAMPLESDIR%%