From 48f7b9758c74c0c87baf7475aa7f9b7b6484e53b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Mon, 14 Oct 2024 14:34:24 +0200 Subject: [PATCH] Sync from SUSE:ALP:Source:Standard:1.0 java-cup revision be5907192bbfa54d6220e8a551c261bc --- .gitattributes | 23 ++ _multibuild | 4 + _service | 13 + java-cup-bootstrap.changes | 89 ++++++ java-cup-bootstrap.spec | 153 +++++++++ java-cup-classpath.patch | 13 + java-cup-d69c832.tar.xz | 3 + java-cup-generated-files.tar.xz | 3 + java-cup-java8.patch | 397 ++++++++++++++++++++++++ java-cup-no-classpath-in-manifest.patch | 15 + java-cup-no-cup-no-jflex.patch | 22 ++ java-cup-nogit.patch.in | 60 ++++ java-cup.changes | 89 ++++++ java-cup.spec | 152 +++++++++ pre_checkin.sh | 14 + 15 files changed, 1050 insertions(+) create mode 100644 .gitattributes create mode 100644 _multibuild create mode 100644 _service create mode 100644 java-cup-bootstrap.changes create mode 100644 java-cup-bootstrap.spec create mode 100644 java-cup-classpath.patch create mode 100644 java-cup-d69c832.tar.xz create mode 100644 java-cup-generated-files.tar.xz create mode 100644 java-cup-java8.patch create mode 100644 java-cup-no-classpath-in-manifest.patch create mode 100644 java-cup-no-cup-no-jflex.patch create mode 100644 java-cup-nogit.patch.in create mode 100644 java-cup.changes create mode 100644 java-cup.spec create mode 100644 pre_checkin.sh diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..fecc750 --- /dev/null +++ b/.gitattributes @@ -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 diff --git a/_multibuild b/_multibuild new file mode 100644 index 0000000..9cabfb3 --- /dev/null +++ b/_multibuild @@ -0,0 +1,4 @@ + + java-cup-bootstrap + + diff --git a/_service b/_service new file mode 100644 index 0000000..df860e2 --- /dev/null +++ b/_service @@ -0,0 +1,13 @@ + + + git + https://versioncontrolseidl.in.tum.de/parsergenerators/cup.git + d69c8321fab81759df10e2d74087a9514b5b56da + %h + java-cup + + + *.tar + xz + + diff --git a/java-cup-bootstrap.changes b/java-cup-bootstrap.changes new file mode 100644 index 0000000..b7dbc87 --- /dev/null +++ b/java-cup-bootstrap.changes @@ -0,0 +1,89 @@ +------------------------------------------------------------------- +Thu May 4 13:47:27 UTC 2023 - Frederic Crozat + +- 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 + +- 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 + +- 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 + +- 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) + diff --git a/java-cup-bootstrap.spec b/java-cup-bootstrap.spec new file mode 100644 index 0000000..e4e0b0c --- /dev/null +++ b/java-cup-bootstrap.spec @@ -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 diff --git a/java-cup-classpath.patch b/java-cup-classpath.patch new file mode 100644 index 0000000..ebb930c --- /dev/null +++ b/java-cup-classpath.patch @@ -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 @@ + + + +- +- ++ ++ + + + diff --git a/java-cup-d69c832.tar.xz b/java-cup-d69c832.tar.xz new file mode 100644 index 0000000..0b159ef --- /dev/null +++ b/java-cup-d69c832.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f6641af174c81ab2743cd399476cdcad1b2b8c42d03787eb8221399b2807b281 +size 690472 diff --git a/java-cup-generated-files.tar.xz b/java-cup-generated-files.tar.xz new file mode 100644 index 0000000..0cfe889 --- /dev/null +++ b/java-cup-generated-files.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2e0fbaba016eaaf9abca1e4afe2225d952789fc8249183d75f3e8355707859e7 +size 19368 diff --git a/java-cup-java8.patch b/java-cup-java8.patch new file mode 100644 index 0000000..8acd1d0 --- /dev/null +++ b/java-cup-java8.patch @@ -0,0 +1,397 @@ +--- a/build.xml ++++ b/build.xml +@@ -56,7 +56,7 @@ + + + +- ++ + + + +--- 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 { + 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 { + 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 { + // 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 { + 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 { + 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 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 { + not_null(other); + + /* walk down the other set and do the adds individually */ +- for (var e : other) +- result = add(e) || result; ++ for (Iterator e = other.iterator(); e.hasNext();) ++ result = add(e.next()) || result; + + return result; + } +@@ -172,8 +172,8 @@ public class symbol_set implements Iterable { + not_null(other); + + /* walk down the other set and do the removes individually */ +- for (var s : other) +- remove(s); ++ for (Iterator s = other.iterator(); s.hasNext();) ++ remove(s.next()); + } + + /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ +@@ -212,8 +212,8 @@ public class symbol_set implements Iterable { + int result = 0; + + /* hash together codes from at most first 5 elements */ +- for (var s : this) +- result ^= s.hashCode(); ++ for (Iterator s = iterator(); s.hasNext(); ) ++ result ^= s.next().hashCode(); + + return result; + } +@@ -228,12 +228,12 @@ public class symbol_set implements Iterable { + + result = "{"; + comma_flag = false; +- for (var s : this) { ++ for (Iterator s = iterator(); s.hasNext();) { + if (comma_flag) + result += ", "; + else + comma_flag = true; +- result += s.name(); ++ result += s.next().name(); + } + result += "}"; + diff --git a/java-cup-no-classpath-in-manifest.patch b/java-cup-no-classpath-in-manifest.patch new file mode 100644 index 0000000..0e63534 --- /dev/null +++ b/java-cup-no-classpath-in-manifest.patch @@ -0,0 +1,15 @@ +--- a/build.xml ++++ b/build.xml +@@ -67,12 +67,10 @@ + + + +- + + + + +- + + + diff --git a/java-cup-no-cup-no-jflex.patch b/java-cup-no-cup-no-jflex.patch new file mode 100644 index 0000000..c47b8ab --- /dev/null +++ b/java-cup-no-cup-no-jflex.patch @@ -0,0 +1,22 @@ +--- a/build.xml ++++ b/build.xml +@@ -44,18 +44,7 @@ + + + +- +- +- +- +- +- +- +- +- +- +- +- ++ + + + diff --git a/java-cup-nogit.patch.in b/java-cup-nogit.patch.in new file mode 100644 index 0000000..ffb796c --- /dev/null +++ b/java-cup-nogit.patch.in @@ -0,0 +1,60 @@ +--- a/build.xml ++++ b/build.xml +@@ -20,26 +20,6 @@ + + + +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- ${changed}${gitversion} + + + +@@ -76,10 +56,6 @@ + + + +- +- + + + +--- 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@)"; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + diff --git a/java-cup.changes b/java-cup.changes new file mode 100644 index 0000000..b7dbc87 --- /dev/null +++ b/java-cup.changes @@ -0,0 +1,89 @@ +------------------------------------------------------------------- +Thu May 4 13:47:27 UTC 2023 - Frederic Crozat + +- 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 + +- 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 + +- 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 + +- 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) + diff --git a/java-cup.spec b/java-cup.spec new file mode 100644 index 0000000..208f602 --- /dev/null +++ b/java-cup.spec @@ -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 diff --git a/pre_checkin.sh b/pre_checkin.sh new file mode 100644 index 0000000..b2806a8 --- /dev/null +++ b/pre_checkin.sh @@ -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