Sync from SUSE:ALP:Source:Standard:1.0 jlex revision b3f132de0c00e3d8c289d607e6cd6c8d

This commit is contained in:
Adrian Schröter 2024-10-14 14:36:40 +02:00
commit e9a563406b
6 changed files with 8187 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

7841
Main.java Normal file

File diff suppressed because it is too large Load Diff

94
jlex-1.2.6.build.xml Normal file
View File

@ -0,0 +1,94 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
-->
<project name="JLex" default="all" basedir=".">
<!-- =================================================================== -->
<!-- Initialization target -->
<!-- =================================================================== -->
<target name="init">
<tstamp/>
<property name="Name" value="JLex"/>
<property name="name" value="jlex"/>
<property name="version" value="1.2.5"/>
<property name="year" value="2001-2002"/>
<echo message=" ------------------- ${Name} ${version} [${year}] ---------"/>
<property name="compile.debug" value="on"/>
<property name="compile.optimize" value="true"/>
<property name="compile.deprecation" value="off"/>
<property name="build.dir" value="build"/>
<property name="dist.dir" value="dist"/>
<property name="bin.dir" value="lib"/>
<property name="lib.dir" value="lib"/>
</target>
<!-- ===================== Prepare Directories ========================= -->
<target name="prepare" depends="init">
<!-- "Build" Hierarchy -->
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.dir}/src"/>
<mkdir dir="${build.dir}/classes"/>
<mkdir dir="${build.dir}/docs"/>
<mkdir dir="${build.dir}/docs/api"/>
<!-- "Dist" Hierarchy -->
<mkdir dir="${dist.dir}"/>
<mkdir dir="${dist.dir}/docs"/>
<mkdir dir="${dist.dir}/docs/api"/>
<mkdir dir="${dist.dir}/lib"/>
</target>
<!-- ======================== Compile Classes ========================== -->
<target name="package" depends="prepare">
<copy todir="${build.dir}/src/JLex" file="Main.java"/>
<javac srcdir="${build.dir}/src"
includes="JLex/**"
destdir="${build.dir}/classes"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}" />
</target>
<!-- ======================== Build JavaDoc =========================== -->
<target name="javadoc" depends="prepare">
<javadoc packagenames="JLex.*" sourcepath="${build.dir}/src"
destdir="${build.dir}/docs/api"
use="true"
windowtitle="JLex v${version} API Documentation"
doctitle="JLex v${version} API Documentation"
bottom="Written by Elliot Berk ejberk@cs.princeton.edu. Copyright 1996." />
</target>
<!-- ===================== Distribution Files ========================= -->
<target name="dist" depends="package">
<copy todir="${dist.dir}/docs/api">
<fileset dir="${build.dir}/docs/api"/>
</copy>
<jar jarfile="${dist.dir}/lib/${name}.jar">
<fileset dir="${build.dir}/classes">
</fileset>
</jar>
</target>
<!-- ====================== Clean Generated Files ===================== -->
<target name="clean" depends="init">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<!-- ========================= All In One Build ======================= -->
<target name="all" depends="clean,dist"/>
</project>

107
jlex-1.2.6.static.patch Normal file
View File

@ -0,0 +1,107 @@
--- Main.java.orig 2003-03-26 11:47:18.000000000 +0100
+++ Main.java 2003-03-26 11:47:21.000000000 +0100
@@ -1072,8 +1072,15 @@
// Added 6/24/98 Raimondas Lencevicius
// May be made more efficient by replacing String operations
// Assumes correctly formed input String. Performs no error checking
+
+ if (Main.staticFlag) { // S.M.Pericas
+ m_outstream.println("\tstatic private int[][] unpackFromString"+
+ "(int size1, int size2, String st) {");
+ }
+ else {
m_outstream.println("\tprivate int[][] unpackFromString"+
"(int size1, int size2, String st) {");
+ }
m_outstream.println("\t\tint colonIndex = -1;");
m_outstream.println("\t\tString lengthString;");
m_outstream.println("\t\tint sequenceLength = 0;");
@@ -1216,13 +1223,23 @@
int[] yy_cmap = new int[m_spec.m_ccls_map.length];
for (i = 0; i < m_spec.m_ccls_map.length; ++i)
yy_cmap[i] = m_spec.m_col_map[m_spec.m_ccls_map[i]];
+ if (Main.staticFlag) {
+ m_outstream.print("\tstatic private int yy_cmap[] = unpackFromString(");
+ }
+ else {
m_outstream.print("\tprivate int yy_cmap[] = unpackFromString(");
+ }
emit_table_as_string(new int[][] { yy_cmap });
m_outstream.println(")[0];");
m_outstream.println();
// CSA: modified yy_rmap to use string packing 9-Aug-1999
+ if (Main.staticFlag) {
+ m_outstream.print("\tstatic private int yy_rmap[] = unpackFromString(");
+ }
+ else {
m_outstream.print("\tprivate int yy_rmap[] = unpackFromString(");
+ }
emit_table_as_string(new int[][] { m_spec.m_row_map });
m_outstream.println(")[0];");
m_outstream.println();
@@ -1237,8 +1254,14 @@
CUtility.ASSERT(dtrans.m_dtrans.length==m_spec.m_dtrans_ncols);
yy_nxt[elem] = dtrans.m_dtrans;
}
+ if (Main.staticFlag) {
+ m_outstream.print
+ ("\tstatic private int yy_nxt[][] = unpackFromString(");
+ }
+ else {
m_outstream.print
("\tprivate int yy_nxt[][] = unpackFromString(");
+ }
emit_table_as_string(yy_nxt);
m_outstream.println(");");
m_outstream.println();
@@ -3825,26 +3848,43 @@
/***************************************************************
Function: main
**************************************************************/
+ public static boolean staticFlag = false;
+
+ public static void printUsage() {
+ System.out.println("Usage: JLex.Main [-static] <filename>");
+ System.exit(1);
+ }
+
public static void main
(
String arg[]
)
throws java.io.IOException
{
+ int i;
CLexGen lg;
- if (arg.length < 1)
- {
- System.out.println("Usage: JLex.Main <filename>");
- return;
- }
+ // Parse options starting with '-'
+ for (i = 0; i < arg.length && arg[i].charAt(0) == '-'; i++) {
+ if (arg[i].equals("-static")) {
+ staticFlag = true;
+ }
+ else {
+ printUsage();
+ }
+ }
+
+ // Enough arguments left ?
+ if (arg.length - i < 1) {
+ printUsage();
+ }
/* Note: For debuging, it may be helpful to remove the try/catch
block and permit the Exception to propagate to the top level.
This gives more information. */
try
{
- lg = new CLexGen(arg[0]);
+ lg = new CLexGen(arg[i]);
lg.generate();
}
catch (Error e)

59
jlex.changes Normal file
View File

@ -0,0 +1,59 @@
-------------------------------------------------------------------
Fri Mar 18 16:44:59 UTC 2022 - Fridrich Strba <fstrba@suse.com>
- Build with source/target levels 8
-------------------------------------------------------------------
Tue Oct 3 11:03:47 UTC 2017 - fstrba@suse.com
- Build with source and target level 1.6 and do not require
java-gcj-compat
- Clean spec file
-------------------------------------------------------------------
Fri Aug 23 09:22:06 UTC 2013 - mvyskocil@suse.com
- don't build javadoc
- use 1.5 source/target
-------------------------------------------------------------------
Mon Nov 8 12:10:48 UTC 2010 - mvyskocil@suse.cz
- build ignore xml-commons-jaxp-1.3-apis
-------------------------------------------------------------------
Sun Jul 27 13:45:56 CEST 2008 - coolo@suse.de
- avoid more packages creating bootstrap problems
-------------------------------------------------------------------
Fri Jul 25 08:08:03 CEST 2008 - coolo@suse.de
- build with gcj to avoid bootstrap problems with openjdk
-------------------------------------------------------------------
Mon Sep 25 17:13:38 CEST 2006 - skh@suse.de
- don't use icecream
- use source="1.4" and target="1.4" for build with java 1.5
-------------------------------------------------------------------
Wed Jan 25 21:46:46 CET 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
-------------------------------------------------------------------
Thu Jul 28 15:30:50 CEST 2005 - jsmeix@suse.de
- Adjustments in the spec file.
-------------------------------------------------------------------
Mon Jul 18 16:43:15 CEST 2005 - jsmeix@suse.de
- Current version 1.2.6 from JPackage.org
-------------------------------------------------------------------
Thu Sep 2 16:49:03 CEST 2004 - skh@suse.de
- Initial package created with version 1.2.6 (JPackage 1.5)

63
jlex.spec Normal file
View File

@ -0,0 +1,63 @@
#
# spec file for package jlex
#
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define section free
Name: jlex
Version: 1.2.6
Release: 0
Summary: A Lexical Analyzer Generator for Java
License: BSD-3-Clause
Group: Development/Libraries/Java
URL: http://www.cs.princeton.edu/~appel/modern/java/JLex/
Source0: http://www.cs.princeton.edu/~appel/modern/java/JLex/Archive/1.2.5/Main.java
Source1: %{name}-%{version}.build.xml
Patch0: %{name}-%{version}.static.patch
BuildRequires: ant
BuildRequires: java-devel >= 1.8
BuildRequires: xml-commons-apis-bootstrap
#!BuildIgnore: xerces-j2
#!BuildIgnore: xml-commons
#!BuildIgnore: xml-commons-apis
#!BuildIgnore: xml-commons-jaxp-1.3-apis
#!BuildIgnore: xml-commons-resolver
#!BuildIgnore: xml-commons-resolver12
BuildArch: noarch
%description
JLex is a lexical analyzer generator for Java.
%prep
%setup -q -c -T
cp %{SOURCE0} .
%patch0
cp %{SOURCE1} build.xml
%build
unset CLASSPATH
ant -Dant.build.javac.source=1.8 -Dant.build.javac.target=1.8
%install
# jar
install -d -m 755 %{buildroot}%{_javadir}
install -m 644 dist/lib/%{name}.jar %{buildroot}%{_javadir}/%{name}-%{version}.jar
(cd %{buildroot}%{_javadir} && for jar in *-%{version}*; do ln -sf ${jar} `echo $jar| sed "s|-%{version}||g"`; done)
%files
%{_javadir}/*
%changelog