Sync from SUSE:SLFO:Main java-cup revision be5907192bbfa54d6220e8a551c261bc

This commit is contained in:
Adrian Schröter 2024-05-03 13:56:44 +02:00
commit c908f98630
15 changed files with 1050 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

4
_multibuild Normal file
View File

@ -0,0 +1,4 @@
<multibuild>
<package>java-cup-bootstrap</package>
</multibuild>

13
_service Normal file
View File

@ -0,0 +1,13 @@
<services>
<service name="tar_scm" mode="disabled">
<param name="scm">git</param>
<param name="url">https://versioncontrolseidl.in.tum.de/parsergenerators/cup.git</param>
<param name="revision">d69c8321fab81759df10e2d74087a9514b5b56da</param>
<param name="versionformat">%h</param>
<param name="filename">java-cup</param>
</service>
<service name="recompress" mode="disabled">
<param name="file">*.tar</param>
<param name="compression">xz</param>
</service>
</services>

View File

@ -0,0 +1,89 @@
-------------------------------------------------------------------
Thu May 4 13:47:27 UTC 2023 - Frederic Crozat <fcrozat@suse.com>
- Add _multibuild to define additional spec files as additional
flavors.
Eliminates the need for source package links in OBS.
-------------------------------------------------------------------
Mon Mar 14 13:15:42 UTC 2022 - Fridrich Strba <fstrba@suse.com>
- Modified patch:
* java-cup-classpath.patch
+ use the java-cup name instead of the java_cup one
- Regenerate the generated files with newer flex
-------------------------------------------------------------------
Fri Jan 14 06:59:22 UTC 2022 - Fridrich Strba <fstrba@suse.com>
- Upgrade to recent git checkout providing 0.11 beta
- Modified patches:
* java-cup-classpath.patch
* java-cup-no-classpath-in-manifest.patch
* java-cup-no-cup-no-jflex.patch
+ rediff to the changed context
- Removed patch:
* java-cup-lr_parser-constructor.patch
+ integrated upstream
- Added patch:
* java-cup-java8.patch
+ replace java 10+ constructs in order to be able to build
with java 8
- Fetch sources using source service
- Do not run git during the build
-------------------------------------------------------------------
Fri Feb 1 16:57:40 UTC 2019 - Fridrich Strba <fstrba@suse.com>
- BuildIgnore xml-commons-apis xml-commons-resolver xalan-j2
and xerces-j2 in order to solve build cycle
-------------------------------------------------------------------
Fri Sep 15 11:16:58 UTC 2017 - fstrba@suse.com
- Do not depend on java-gcj-compat
- Fix build with jdk9: specify source and target 1.6
-------------------------------------------------------------------
Thu Aug 29 07:47:30 UTC 2013 - mvyskocil@suse.com
- Add conflicts for each variant
- Sync .changes
- Drop weird jpackage-prepare script and use standard pre_checkin.sh
-------------------------------------------------------------------
Fri Aug 23 08:06:54 UTC 2013 - mvyskocil@suse.com
- Disable build of javadoc
* drop java-cup-javadoc.patch
-------------------------------------------------------------------
Fri Jan 25 15:36:53 UTC 2013 - coolo@suse.com
- sync licenses
-------------------------------------------------------------------
Mon Jun 4 13:08:48 UTC 2012 - cfarrell@suse.com
- license update: HPND
SPDX syntax
-------------------------------------------------------------------
Mon Nov 8 11:55:22 UTC 2010 - mvyskocil@suse.cz
- Build ignore xml-comons-jax-1.3-apis
-------------------------------------------------------------------
Mon May 11 16:33:27 CEST 2009 - mvyskocil@suse.cz
- Fixed bnc#501635: Added a lincense file
-------------------------------------------------------------------
Tue May 5 09:01:11 CEST 2009 - mvyskocil@suse.cz
- Build using gcj (for proper bootstrap of openjdk)
-------------------------------------------------------------------
Wed Apr 29 10:27:07 CEST 2009 - mvyskocil@suse.cz
- Initial packaging of java-cup-bootstrap 0.11 in SUSE (from jpp5)

153
java-cup-bootstrap.spec Normal file
View File

@ -0,0 +1,153 @@
#
# spec file for package java-cup-bootstrap
#
# Copyright (c) 2023 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/
#
##### WARNING: please do not edit this auto generated spec file. Use the java-cup.spec! #####
%global with_bootstrap 1
%define cvs_version 11b
%define real_name java-cup
%define git_hash d69c832
%define git_date 20210814
%bcond_with bootstrap
Name: java-cup-bootstrap
Version: 0.11
Release: 0
Summary: LALR Parser Generator in Java
License: HPND
Group: Development/Libraries/Java
URL: http://www2.cs.tum.edu/projects/cup/
Source0: %{real_name}-%{git_hash}.tar.xz
Source1: %{real_name}-generated-files.tar.xz
Source100: java-cup-nogit.patch.in
Patch0: java-cup-no-classpath-in-manifest.patch
Patch1: java-cup-java8.patch
Patch2: java-cup-no-cup-no-jflex.patch
Patch3: java-cup-classpath.patch
BuildRequires: ant
BuildRequires: java-devel
BuildRequires: javapackages-tools
BuildRequires: xml-commons-apis-bootstrap
BuildRequires: xml-commons-resolver-bootstrap
#!BuildIgnore: xalan-j2
#!BuildIgnore: xerces-j2
#!BuildIgnore: xml-commons-apis
#!BuildIgnore: xml-commons-resolver
Obsoletes: java_cup < %{version}-%{release}
Provides: java_cup = %{version}-%{release}
BuildArch: noarch
%if %{without bootstrap}
BuildRequires: java-cup-bootstrap
BuildRequires: javapackages-local
BuildRequires: jflex-bootstrap
Conflicts: java-cup-bootstrap
%else
Conflicts: java-cup
%endif
%description
java-cup is a LALR Parser Generator in Java. With v0.11, you can: *
use CUP in an Ant-Target
* start CUP by a simple command like java -jar java-cup-11a.jar
myGrammar.cup
* use generic parametrized classes (since Java 1.5) as datatypes for
non terminals and terminals
* have Your own symbol classes
%if %{without bootstrap}
%package manual
Summary: LALR Parser Generator in Java
Group: Development/Libraries/Java
%description manual
java-cup is a LALR Parser Generator in Java. With v0.11, you can: *
use CUP in an Ant-Target
* start CUP by a simple command like java -jar java-cup-11a.jar
myGrammar.cup
* use generic parametrized classes (since Java 1.5) as datatypes for
non
* terminals and terminals
* have Your own symbol classes
%endif
%prep
%setup -q -n %{real_name}-%{git_hash}
cat %{SOURCE100} | sed 's#@GIT_HASH@#%{git_hash}#g' | sed 's#@GIT_DATE@#%{git_date}#g' | patch -p1 -u -l
%patch0 -p1
%patch1 -p1
%if %{with bootstrap}
%setup -q -T -D -a 1 -n %{real_name}-%{git_hash}
%patch2 -p1
%else
%patch3 -p1
%endif
find . -name '*.jar' -print -delete
mkdir -p target/classes
%build
%if %{with bootstrap}
export CLASSPATH=
%else
export CLASSPATH=$(build-classpath java-cup jflex)
%endif
export OPT_JAR_LIST=:
ant
%install
# jar
mkdir -p %{buildroot}%{_javadir}
cp -a target/dist/%{real_name}-%{cvs_version}.jar %{buildroot}%{_javadir}/%{real_name}.jar
cp -a target/dist/%{real_name}-%{cvs_version}-runtime.jar %{buildroot}%{_javadir}/%{real_name}-runtime.jar
%if %{without bootstrap}
# maven data
%add_maven_depmap com.github.vbmacher:%{real_name}:%{cvs_version}-%{git_date} %{real_name}.jar
%add_maven_depmap com.github.vbmacher:%{real_name}-runtime:%{cvs_version}-%{git_date} %{real_name}-runtime.jar
%endif
# compatibility symlinks
(cd %{buildroot}%{_javadir} && ln -s %{real_name}.jar java_cup.jar && ln -s %{real_name}-runtime.jar java_cup-runtime.jar)
mkdir -p %{buildroot}%{_bindir}
%jpackage_script java_cup.Main "" "" %{real_name}:%{real_name}-runtime %{real_name} true
%if %{with bootstrap}
%files
%{_javadir}/%{real_name}*.jar
%else
%files -f .mfiles
%endif
%license licence.txt
%doc changelog.txt
%attr(0755,root,root) %{_bindir}/%{real_name}
%{_javadir}/java_cup*.jar
%if %{without bootstrap}
%files manual
%doc manual.html
%endif
%changelog

13
java-cup-classpath.patch Normal file
View File

@ -0,0 +1,13 @@
--- develop/build.xml.orig 2006-09-09 06:16:46.000000000 +0200
+++ develop/build.xml 2006-09-09 06:20:38.000000000 +0200
@@ -40,8 +40,8 @@
<delete dir="${dist}" />
</target>
- <taskdef name="cup" classname="java_cup.anttask.CUPTask" classpath="${bin}/java-cup-11.jar" />
- <taskdef name="jflex" classname="JFlex.anttask.JFlexTask" classpath="${bin}/JFlex.jar" />
+ <taskdef name="cup" classname="java_cup.anttask.CUPTask" classpath="/usr/share/java/java-cup.jar" />
+ <taskdef name="jflex" classname="jflex.anttask.JFlexTask" classpath="/usr/share/java/jflex.jar" />
<target name="cup" depends="init">
<cup srcfile="${cup}/parser.cup" interface="on" destdir="${java}" parser="parser" symbols="sym" quiet="false" nonterms="true"/>

BIN
java-cup-d69c832.tar.xz (Stored with Git LFS) Normal file

Binary file not shown.

BIN
java-cup-generated-files.tar.xz (Stored with Git LFS) Normal file

Binary file not shown.

397
java-cup-java8.patch Normal file
View File

@ -0,0 +1,397 @@
--- a/build.xml
+++ b/build.xml
@@ -56,7 +56,7 @@
</target>
<target name="compile" depends="jflex">
- <javac srcdir="${java}" destdir="${classes}" verbose="off" listfiles="off" debug="on" source="10" target="10">
+ <javac srcdir="${java}" destdir="${classes}" verbose="off" listfiles="off" debug="on" source="1.8" target="1.8">
<classpath refid="libraries"/>
<compilerarg value="-Xlint:unchecked" />
<compilerarg value="-Xdiags:verbose" />
--- a/src/java/java_cup/Main.java
+++ b/src/java/java_cup/Main.java
@@ -527,7 +527,7 @@ public class Main {
protected static void check_unused() {
/* check for unused terminals */
- for (var term : terminal.all()) {
+ for (terminal term : terminal.all()) {
/* don't issue a message for EOF */
if (term == terminal.EOF)
continue;
@@ -547,7 +547,7 @@ public class Main {
}
/* check for unused non terminals */
- for (var nt:non_terminal.all()){
+ for (non_terminal nt:non_terminal.all()){
/* is this one unused */
if (nt.use_count() == 0) {
/* count and warn if we are doing warnings */
@@ -613,7 +613,7 @@ public class Main {
System.err.println(" Filling in tables...");
action_table = new parse_action_table();
reduce_table = new parse_reduce_table();
- for (var lst:lalr_state.all_states()){
+ for (lalr_state lst:lalr_state.all_states()){
lst.build_table_entries(action_table, reduce_table);
}
@@ -846,7 +846,7 @@ public class Main {
lalr_state ordered[] = new lalr_state[lalr_state.number()];
/* put the states in sorted order for a nicer display */
- for (var st : lalr_state.all_states()){
+ for (lalr_state st : lalr_state.all_states()){
ordered[st.index()] = st;
}
--- a/src/java/java_cup/emit.java
+++ b/src/java/java_cup/emit.java
@@ -624,14 +624,14 @@ public class emit {
/* collect up the productions in order */
all_prods = new production[production.number()];
- for (var prod:production.all()){
+ for (production prod:production.all()){
all_prods[prod.index()] = prod;
}
// make short[][]
short[][] prod_table = new short[production.number()][2];
for (int i = 0; i < production.number(); i++) {
- var prod = all_prods[i];
+ production prod = all_prods[i];
// { lhs symbol , rhs size }
prod_table[i][0] = (short) prod.lhs().the_symbol().index();
prod_table[i][1] = (short) prod.rhs_length();
@@ -818,12 +818,12 @@ public class emit {
nchar = do_newline(out, nchar, nbytes);
nbytes += do_escaped(out, (char) (sa.length & 0xFFFF));
nchar = do_newline(out, nchar, nbytes);
- for (var element:sa) {
+ for (short[] element:sa) {
nbytes += do_escaped(out, (char) (element.length >> 16));
nchar = do_newline(out, nchar, nbytes);
nbytes += do_escaped(out, (char) (element.length & 0xFFFF));
nchar = do_newline(out, nchar, nbytes);
- for (var element2 : element) {
+ for (short element2 : element) {
// contents of string are (value+2) to allow for common -1, 0 cases
// (UTF-8 encoding is most efficient for 0<c<0x80)
nbytes += do_escaped(out, (char) (2 + element2));
--- a/src/java/java_cup/lalr_item_set.java
+++ b/src/java/java_cup/lalr_item_set.java
@@ -206,7 +206,7 @@ public class lalr_item_set implements Iterable<lalr_item> {
public lalr_item get_one() throws internal_error {
if (_all.values().size() == 0)
return null;
- var result = iterator().next();
+ lalr_item result = iterator().next();
remove(result);
return result;
}
@@ -255,30 +255,30 @@ public class lalr_item_set implements Iterable<lalr_item> {
hashcode_cache = null;
/* each current element needs to be considered */
- var consider = new lalr_item_set(this);
+ lalr_item_set consider = new lalr_item_set(this);
/* repeat this until there is nothing else to consider */
while (consider.size() > 0) {
/* get one item to consider */
- var itm = consider.get_one();
+ lalr_item itm = consider.get_one();
/* do we have a dot before a non terminal */
- var nt = itm.dot_before_nt();
+ non_terminal nt = itm.dot_before_nt();
if (nt != null) {
/* create the lookahead set based on first after dot */
- var new_lookaheads = itm.calc_lookahead(itm.lookahead());
+ terminal_set new_lookaheads = itm.calc_lookahead(itm.lookahead());
/* are we going to need to propagate our lookahead to new item */
- var need_prop = itm.lookahead_visible();
+ boolean need_prop = itm.lookahead_visible();
/* create items for each production of that non term */
- for (var prod : nt.productions()) {
+ for (production prod : nt.productions()) {
/* create new item with dot at start and that lookahead */
- var new_itm = new lalr_item(prod, new terminal_set(new_lookaheads));
+ lalr_item new_itm = new lalr_item(prod, new terminal_set(new_lookaheads));
/* add/merge item into the set */
- var add_itm = add(new_itm);
+ lalr_item add_itm = add(new_itm);
/* if propagation is needed link to that item */
if (need_prop)
itm.add_propagate(add_itm);
@@ -335,7 +335,7 @@ public class lalr_item_set implements Iterable<lalr_item> {
// CSA fix! we'd *like* to hash just a few elements, but
// that means equal sets will have inequal hashcodes, which
// we're not allowed (by contract) to do. So hash them all.
- for (var e : this)
+ for (lalr_item e : this)
result ^= e.hashCode();
hashcode_cache = Integer.valueOf(result);
@@ -352,7 +352,7 @@ public class lalr_item_set implements Iterable<lalr_item> {
StringBuilder result = new StringBuilder();
result.append("{\n");
- for (var e : this)
+ for (lalr_item e : this)
result.append(" " + e + "\n");
result.append("}");
--- a/src/java/java_cup/lalr_state.java
+++ b/src/java/java_cup/lalr_state.java
@@ -187,14 +187,14 @@ public class lalr_state {
}
System.out.println("lalr_state [" + st.index() + "] {");
- for (var itm : st.items()) {
+ for (lalr_item itm : st.items()) {
System.out.print(" [");
System.out.print(itm.the_production().lhs().the_symbol().name());
System.out.print(" ::= ");
for (int i = 0; i < itm.the_production().rhs_length(); i++) {
if (i == itm.dot_pos())
System.out.print("\u00B7 ");
- var part = itm.the_production().rhs(i);
+ production_part part = itm.the_production().rhs(i);
if (part.is_action())
System.out.print("{action} ");
else
@@ -219,7 +219,7 @@ public class lalr_state {
*/
protected static void propagate_all_lookaheads() throws internal_error {
/* iterate across all states */
- for (var st : all_states())
+ for (lalr_state st : all_states())
st.propagate_lookaheads();
}
@@ -298,7 +298,7 @@ public class lalr_state {
/* build item with dot at front of start production and EOF lookahead */
start_items = new lalr_item_set();
- var start_itm = new lalr_item(start_prod);
+ lalr_item start_itm = new lalr_item(start_prod);
start_itm.lookahead().add(terminal.EOF);
start_items.add(start_itm);
@@ -319,29 +319,29 @@ public class lalr_state {
/* continue looking at new states until we have no more work to do */
while (!work_stack.empty()) {
/* remove a state from the work set */
- var st = work_stack.pop();
+ lalr_state st = work_stack.pop();
/* gather up all the symbols that appear before dots */
- var outgoing = new symbol_set();
- for (var itm : st.items()) {
+ symbol_set outgoing = new symbol_set();
+ for (lalr_item itm : st.items()) {
/* add the symbol before the dot (if any) to our collection */
- var sym = itm.symbol_after_dot();
+ symbol sym = itm.symbol_after_dot();
if (sym != null)
outgoing.add(sym);
}
/* now create a transition out for each individual symbol */
- for (var sym : outgoing) {
+ for (symbol sym : outgoing) {
/* will be keeping the set of items with propagate links */
- var linked_items = new lalr_item_set();
+ lalr_item_set linked_items = new lalr_item_set();
// gather up shifted versions of all the items that have this symbol before the
// dot
- var new_items = new lalr_item_set();
- for (var itm : st.items()) {
+ lalr_item_set new_items = new lalr_item_set();
+ for (lalr_item itm : st.items()) {
/* if this is the symbol we are working on now, add to set */
- var sym2 = itm.symbol_after_dot();
+ symbol sym2 = itm.symbol_after_dot();
if (sym.equals(sym2)) {
/* add to the kernel of the new state */
new_items.add(itm.shift());
@@ -353,7 +353,7 @@ public class lalr_state {
/* use new items as state kernel */
kernel = new lalr_item_set(new_items);
/* have we seen this one already? */
- var new_st = _all_kernels.get(kernel);
+ lalr_state new_st = _all_kernels.get(kernel);
/* if we haven't, build a new state out of the item set */
if (new_st == null) {
@@ -372,7 +372,7 @@ public class lalr_state {
/* otherwise relink propagation to items in existing state */
else {
/* walk through the items that have links to the new state */
- for (var fix_itm : linked_items) {
+ for (lalr_item fix_itm : linked_items) {
/* look at each propagate link out of that item */
for (int l = 0; l < fix_itm.propagate_items().size(); l++) {
@@ -410,7 +410,7 @@ public class lalr_state {
*/
protected void propagate_lookaheads() throws internal_error {
/* recursively propagate out from each item in the state */
- for (var itm : items())
+ for (lalr_item itm : items())
itm.propagate_lookaheads(null);
}
@@ -439,17 +439,17 @@ public class lalr_state {
* @param reduce_table the reduce-goto table to put entries in.
*/
public void build_table_entries(parse_action_table act_table, parse_reduce_table reduce_table) throws internal_error {
- var conflict_set = new terminal_set();
+ terminal_set conflict_set = new terminal_set();
/* pull out our rows from the tables */
- var our_act_row = act_table.under_state[index()];
- var our_red_row = reduce_table.under_state[index()];
+ parse_action_row our_act_row = act_table.under_state[index()];
+ parse_reduce_row our_red_row = reduce_table.under_state[index()];
/* consider each item in our state */
- for (var itm : items()) {
+ for (lalr_item itm : items()) {
/* if its completed (dot at end) then reduce under the lookahead */
if (itm.dot_at_end()) {
- var act = new reduce_action(itm.the_production());
+ reduce_action act = new reduce_action(itm.the_production());
/* consider each lookahead symbol */
for (int t = 0; t < terminal.number(); t++) {
@@ -463,7 +463,7 @@ public class lalr_state {
} else {
/* we now have at least one conflict */
terminal term = terminal.find(t);
- var other_act = our_act_row.under_term[t];
+ parse_action other_act = our_act_row.under_term[t];
/* if the other act was not a shift */
if ((other_act.kind() != parse_action.SHIFT) && (other_act.kind() != parse_action.NONASSOC)) {
@@ -490,9 +490,9 @@ public class lalr_state {
/* consider each outgoing transition */
for (lalr_transition trans = transitions(); trans != null; trans = trans.next()) {
/* if its on an terminal add a shift entry */
- var sym = trans.on_symbol();
+ symbol sym = trans.on_symbol();
if (!sym.is_non_term()) {
- var act = new shift_action(trans.to_state());
+ shift_action act = new shift_action(trans.to_state());
/* if we don't already have an action put this one in */
if (our_act_row.under_term[sym.index()].kind() == parse_action.ERROR) {
@@ -641,7 +641,7 @@ public class lalr_state {
boolean after_itm;
/* consider each element */
- for (var itm : items()) {
+ for (lalr_item itm : items()) {
/* clear the S/R conflict set for this item */
/* if it results in a reduce, it could be a conflict */
@@ -650,7 +650,7 @@ public class lalr_state {
after_itm = false;
/* compare this item against all others looking for conflicts */
- for (var compare : items()) {
+ for (lalr_item compare : items()) {
/* if this is the item, next one is after it */
if (itm == compare)
after_itm = true;
@@ -727,7 +727,7 @@ public class lalr_state {
int relevancecounter = 0;
/* find and report on all items that shift under our conflict symbol */
- for (var itm : items()) {
+ for (lalr_item itm : items()) {
/* only look if its not the same item and not a reduce */
if (itm != red_itm && !itm.dot_at_end()) {
--- a/src/java/java_cup/parse_action_table.java
+++ b/src/java/java_cup/parse_action_table.java
@@ -73,7 +73,7 @@ public class parse_action_table {
}
/* now go across every production and make sure we hit it */
- for (var prod : production.all()){
+ for (production prod : production.all()){
/* if we didn't hit it give a warning */
if (prod.num_reductions() == 0) {
/*
--- a/src/java/java_cup/symbol_set.java
+++ b/src/java/java_cup/symbol_set.java
@@ -90,8 +90,8 @@ public class symbol_set implements Iterable<symbol> {
not_null(other);
/* walk down our set and make sure every element is in the other */
- for (var e : this)
- if (!other.contains(e))
+ for (Iterator<symbol> e = iterator(); e.hasNext();)
+ if (!other.contains(e.next()))
return false;
/* they were all there */
return true;
@@ -155,8 +155,8 @@ public class symbol_set implements Iterable<symbol> {
not_null(other);
/* walk down the other set and do the adds individually */
- for (var e : other)
- result = add(e) || result;
+ for (Iterator<symbol> e = other.iterator(); e.hasNext();)
+ result = add(e.next()) || result;
return result;
}
@@ -172,8 +172,8 @@ public class symbol_set implements Iterable<symbol> {
not_null(other);
/* walk down the other set and do the removes individually */
- for (var s : other)
- remove(s);
+ for (Iterator<symbol> s = other.iterator(); s.hasNext();)
+ remove(s.next());
}
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
@@ -212,8 +212,8 @@ public class symbol_set implements Iterable<symbol> {
int result = 0;
/* hash together codes from at most first 5 elements */
- for (var s : this)
- result ^= s.hashCode();
+ for (Iterator<symbol> s = iterator(); s.hasNext(); )
+ result ^= s.next().hashCode();
return result;
}
@@ -228,12 +228,12 @@ public class symbol_set implements Iterable<symbol> {
result = "{";
comma_flag = false;
- for (var s : this) {
+ for (Iterator<symbol> s = iterator(); s.hasNext();) {
if (comma_flag)
result += ", ";
else
comma_flag = true;
- result += s.name();
+ result += s.next().name();
}
result += "}";

View File

@ -0,0 +1,15 @@
--- a/build.xml
+++ b/build.xml
@@ -67,12 +67,10 @@
<jar jarfile="${dist}/java-cup-11b.jar" basedir="${classes}">
<manifest>
<attribute name="Main-Class" value="java_cup/Main" />
- <attribute name="Class-Path" value="java-cup-11b-runtime.jar" />
</manifest>
</jar>
<jar jarfile="${dist}/java-cup-11b-runtime.jar" basedir="${classes}" includes="java_cup/runtime/**">
<manifest>
- <attribute name="Class-Path" value="commons-jxpath-1.3.jar" />
</manifest>
</jar>
<tar longfile="gnu" destfile="${dist}/java-cup-bin-11b-${cupversion}.tar.gz" compression="gzip">

View File

@ -0,0 +1,22 @@
--- a/build.xml
+++ b/build.xml
@@ -44,18 +44,7 @@
<delete dir="${dist}" />
</target>
- <taskdef name="cup" classname="java_cup.anttask.CUPTask" classpath="${bin}/java-cup-11.jar" />
- <taskdef name="jflex" classname="JFlex.anttask.JFlexTask" classpath="${bin}/JFlex.jar" />
-
- <target name="cup" depends="init">
- <cup srcfile="${cup}/parser.cup" interface="on" destdir="${java}" parser="parser" symbols="sym" quiet="false" nonterms="true"/>
- </target>
-
- <target name="jflex" depends="cup">
- <jflex file="${flex}/Lexer.jflex" destdir="${java}" />
- </target>
-
- <target name="compile" depends="jflex">
+ <target name="compile">
<javac srcdir="${java}" destdir="${classes}" verbose="off" listfiles="off" debug="on" source="1.8" target="1.8">
<classpath refid="libraries"/>
<compilerarg value="-Xlint:unchecked" />

60
java-cup-nogit.patch.in Normal file
View File

@ -0,0 +1,60 @@
--- a/build.xml
+++ b/build.xml
@@ -20,26 +20,6 @@
<mkdir dir="${dist}" />
<loadfile property="cupversion" srcFile="version.txt" failonerror="false" />
<property name="cupversion" value="custombuild" unless:set="cupversion"/>
- <exec executable="git" outputproperty="gitversion">
- <arg value="log"/>
- <arg value="-1"/>
- <arg value="--format=%h"/>
- </exec>
- <exec executable="git" outputproperty="changed">
- <arg value="status"/>
- <arg value="--porcelain"/>
- <redirector>
- <outputfilterchain>
- <linecontainsregexp>
- <regexp pattern='^M.*'/>
- </linecontainsregexp>
- <tokenfilter>
- <replaceregex pattern=".*" replace="modifications based on "/>
- </tokenfilter>
- </outputfilterchain>
- </redirector>
- </exec>
- <property name="svnversion">${changed}${gitversion}</property>
</target>
<property environment="env" />
@@ -76,10 +56,6 @@
</target>
<target name="compile" depends="jflex">
- <replace file="${java}/java_cup/version.java"
- token="+ version_str"
- value='+ "v0.11b ${cupversion} (GIT ${svnversion})"'>
- </replace>
<javac srcdir="${java}" destdir="${classes}" verbose="off" listfiles="off" debug="on" source="10" target="10">
<classpath refid="libraries"/>
<compilerarg value="-Xlint:unchecked" />
--- a/src/java/java_cup/version.java
+++ b/src/java/java_cup/version.java
@@ -30,7 +30,7 @@ public class version {
/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
/** The update letter. */
- public static final String update = "b beta 20140226";
+ public static final String update = "b beta @GIT_DATE@";
/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
@@ -40,7 +40,7 @@ public class version {
/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
/** Full title of the system */
- public static final String title_str = "CUP " + "v0.11b 20160615 (GIT 3d0ae71)";
+ public static final String title_str = "CUP " + "v0.11b @GIT_DATE@ (GIT @GIT_HASH@)";
/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/

89
java-cup.changes Normal file
View File

@ -0,0 +1,89 @@
-------------------------------------------------------------------
Thu May 4 13:47:27 UTC 2023 - Frederic Crozat <fcrozat@suse.com>
- Add _multibuild to define additional spec files as additional
flavors.
Eliminates the need for source package links in OBS.
-------------------------------------------------------------------
Mon Mar 14 13:15:42 UTC 2022 - Fridrich Strba <fstrba@suse.com>
- Modified patch:
* java-cup-classpath.patch
+ use the java-cup name instead of the java_cup one
- Regenerate the generated files with newer flex
-------------------------------------------------------------------
Fri Jan 14 06:59:22 UTC 2022 - Fridrich Strba <fstrba@suse.com>
- Upgrade to recent git checkout providing 0.11 beta
- Modified patches:
* java-cup-classpath.patch
* java-cup-no-classpath-in-manifest.patch
* java-cup-no-cup-no-jflex.patch
+ rediff to the changed context
- Removed patch:
* java-cup-lr_parser-constructor.patch
+ integrated upstream
- Added patch:
* java-cup-java8.patch
+ replace java 10+ constructs in order to be able to build
with java 8
- Fetch sources using source service
- Do not run git during the build
-------------------------------------------------------------------
Fri Feb 1 16:57:40 UTC 2019 - Fridrich Strba <fstrba@suse.com>
- BuildIgnore xml-commons-apis xml-commons-resolver xalan-j2
and xerces-j2 in order to solve build cycle
-------------------------------------------------------------------
Fri Sep 15 11:16:58 UTC 2017 - fstrba@suse.com
- Do not depend on java-gcj-compat
- Fix build with jdk9: specify source and target 1.6
-------------------------------------------------------------------
Thu Aug 29 07:47:30 UTC 2013 - mvyskocil@suse.com
- Add conflicts for each variant
- Sync .changes
- Drop weird jpackage-prepare script and use standard pre_checkin.sh
-------------------------------------------------------------------
Fri Aug 23 08:06:54 UTC 2013 - mvyskocil@suse.com
- Disable build of javadoc
* drop java-cup-javadoc.patch
-------------------------------------------------------------------
Fri Jan 25 15:36:53 UTC 2013 - coolo@suse.com
- sync licenses
-------------------------------------------------------------------
Mon Jun 4 13:08:48 UTC 2012 - cfarrell@suse.com
- license update: HPND
SPDX syntax
-------------------------------------------------------------------
Mon Nov 8 11:55:22 UTC 2010 - mvyskocil@suse.cz
- Build ignore xml-comons-jax-1.3-apis
-------------------------------------------------------------------
Mon May 11 16:33:27 CEST 2009 - mvyskocil@suse.cz
- Fixed bnc#501635: Added a lincense file
-------------------------------------------------------------------
Tue May 5 09:01:11 CEST 2009 - mvyskocil@suse.cz
- Build using gcj (for proper bootstrap of openjdk)
-------------------------------------------------------------------
Wed Apr 29 10:27:07 CEST 2009 - mvyskocil@suse.cz
- Initial packaging of java-cup-bootstrap 0.11 in SUSE (from jpp5)

152
java-cup.spec Normal file
View File

@ -0,0 +1,152 @@
#
# spec file for package java-cup
#
# Copyright (c) 2023 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/
#
%global _without_bootstrap 1
%define cvs_version 11b
%define real_name java-cup
%define git_hash d69c832
%define git_date 20210814
%bcond_with bootstrap
Name: java-cup
Version: 0.11
Release: 0
Summary: LALR Parser Generator in Java
License: HPND
Group: Development/Libraries/Java
URL: http://www2.cs.tum.edu/projects/cup/
Source0: %{real_name}-%{git_hash}.tar.xz
Source1: %{real_name}-generated-files.tar.xz
Source100: java-cup-nogit.patch.in
Patch0: java-cup-no-classpath-in-manifest.patch
Patch1: java-cup-java8.patch
Patch2: java-cup-no-cup-no-jflex.patch
Patch3: java-cup-classpath.patch
BuildRequires: ant
BuildRequires: java-devel
BuildRequires: javapackages-tools
BuildRequires: xml-commons-apis-bootstrap
BuildRequires: xml-commons-resolver-bootstrap
#!BuildIgnore: xalan-j2
#!BuildIgnore: xerces-j2
#!BuildIgnore: xml-commons-apis
#!BuildIgnore: xml-commons-resolver
Obsoletes: java_cup < %{version}-%{release}
Provides: java_cup = %{version}-%{release}
BuildArch: noarch
%if %{without bootstrap}
BuildRequires: java-cup-bootstrap
BuildRequires: javapackages-local
BuildRequires: jflex-bootstrap
Conflicts: java-cup-bootstrap
%else
Conflicts: java-cup
%endif
%description
java-cup is a LALR Parser Generator in Java. With v0.11, you can: *
use CUP in an Ant-Target
* start CUP by a simple command like java -jar java-cup-11a.jar
myGrammar.cup
* use generic parametrized classes (since Java 1.5) as datatypes for
non terminals and terminals
* have Your own symbol classes
%if %{without bootstrap}
%package manual
Summary: LALR Parser Generator in Java
Group: Development/Libraries/Java
%description manual
java-cup is a LALR Parser Generator in Java. With v0.11, you can: *
use CUP in an Ant-Target
* start CUP by a simple command like java -jar java-cup-11a.jar
myGrammar.cup
* use generic parametrized classes (since Java 1.5) as datatypes for
non
* terminals and terminals
* have Your own symbol classes
%endif
%prep
%setup -q -n %{real_name}-%{git_hash}
cat %{SOURCE100} | sed 's#@GIT_HASH@#%{git_hash}#g' | sed 's#@GIT_DATE@#%{git_date}#g' | patch -p1 -u -l
%patch0 -p1
%patch1 -p1
%if %{with bootstrap}
%setup -q -T -D -a 1 -n %{real_name}-%{git_hash}
%patch2 -p1
%else
%patch3 -p1
%endif
find . -name '*.jar' -print -delete
mkdir -p target/classes
%build
%if %{with bootstrap}
export CLASSPATH=
%else
export CLASSPATH=$(build-classpath java-cup jflex)
%endif
export OPT_JAR_LIST=:
ant
%install
# jar
mkdir -p %{buildroot}%{_javadir}
cp -a target/dist/%{real_name}-%{cvs_version}.jar %{buildroot}%{_javadir}/%{real_name}.jar
cp -a target/dist/%{real_name}-%{cvs_version}-runtime.jar %{buildroot}%{_javadir}/%{real_name}-runtime.jar
%if %{without bootstrap}
# maven data
%add_maven_depmap com.github.vbmacher:%{real_name}:%{cvs_version}-%{git_date} %{real_name}.jar
%add_maven_depmap com.github.vbmacher:%{real_name}-runtime:%{cvs_version}-%{git_date} %{real_name}-runtime.jar
%endif
# compatibility symlinks
(cd %{buildroot}%{_javadir} && ln -s %{real_name}.jar java_cup.jar && ln -s %{real_name}-runtime.jar java_cup-runtime.jar)
mkdir -p %{buildroot}%{_bindir}
%jpackage_script java_cup.Main "" "" %{real_name}:%{real_name}-runtime %{real_name} true
%if %{with bootstrap}
%files
%{_javadir}/%{real_name}*.jar
%else
%files -f .mfiles
%endif
%license licence.txt
%doc changelog.txt
%attr(0755,root,root) %{_bindir}/%{real_name}
%{_javadir}/java_cup*.jar
%if %{without bootstrap}
%files manual
%doc manual.html
%endif
%changelog

14
pre_checkin.sh Normal file
View File

@ -0,0 +1,14 @@
#!/bin/bash
NAME1=java-cup
NAME2=java-cup-bootstrap
COPY_CHANGES=true
EDIT_WARNING="##### WARNING: please do not edit this auto generated spec file. Use the ${NAME1}.spec! #####\n"
sed "s/^%global _without_bootstrap.*$/${EDIT_WARNING}%global with_bootstrap 1/;
s/^\(Name:.*\)$/\1-bootstrap/;
" < ${NAME1}.spec > ${NAME2:-${NAME1}-bootstrap}.spec
if ${COPY_CHANGES}; then
cp ${NAME1}.changes ${NAME2:-${NAME1}-bootstrap}.changes
fi