forked from pool/java-cup
This commit is contained in:
parent
97fe44708b
commit
00f26dc6a8
13
_service
Normal file
13
_service
Normal 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>
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:9a54e59544618844fd5209d40b7832b4623753fd1432bd60bd73cac347d27e69
|
||||
size 285904
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package java-cup-bootstrap
|
||||
#
|
||||
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
# 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
|
||||
@ -18,8 +18,10 @@
|
||||
|
||||
##### WARNING: please do not edit this auto generated spec file. Use the java-cup.spec! #####
|
||||
%global with_bootstrap 1
|
||||
%define cvs_version 11a
|
||||
%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
|
||||
@ -27,28 +29,29 @@ Release: 0
|
||||
Summary: LALR Parser Generator in Java
|
||||
License: HPND
|
||||
Group: Development/Libraries/Java
|
||||
Url: http://www2.cs.tum.edu/projects/cup/
|
||||
# https://www2.in.tum.de/WebSVN/dl.php?repname=CUP&path=/develop/&rev=0&isdir=1
|
||||
Source0: develop.tar.bz2
|
||||
Source1: java-cup.script
|
||||
Source2: java-cup-generated-files.tar.bz2
|
||||
# From http://www2.cs.tum.edu/projects/cup/
|
||||
Source3: java-cup.license
|
||||
Patch1: java-cup-no-classpath-in-manifest.patch
|
||||
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
|
||||
# Missing symbolFactory initialization in lr_parser, causes sinjdoc to crash
|
||||
Patch4: java-cup-lr_parser-constructor.patch
|
||||
BuildRequires: ant
|
||||
BuildRequires: java-devel
|
||||
BuildRequires: javapackages-tools
|
||||
BuildRequires: xml-commons-apis-bootstrap
|
||||
BuildRequires: xml-commons-resolver-bootstrap
|
||||
#!BuildIgnore: xml-commons-apis xml-commons-resolver xalan-j2 xerces-j2
|
||||
#!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
|
||||
%endif
|
||||
# bootstrap variant is just stripped down java-cup, so it conflicts
|
||||
@ -92,19 +95,18 @@ java-cup is a LALR Parser Generator in Java. With v0.11, you can: *
|
||||
%endif
|
||||
|
||||
%prep
|
||||
%setup -q -n develop
|
||||
%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 2 -n develop
|
||||
%setup -q -T -D -a 1 -n %{real_name}-%{git_hash}
|
||||
%patch2 -p1
|
||||
%else
|
||||
%{_bindir}/find . -name '*.jar' | %{_bindir}/xargs rm
|
||||
%patch3 -p1
|
||||
%endif
|
||||
%patch4 -p1
|
||||
perl -pi -e 's/1\.2/1.6/g' build.xml
|
||||
mkdir -p classes dist
|
||||
cp %{SOURCE3} license.txt
|
||||
mkdir -p target/classes
|
||||
|
||||
%build
|
||||
%if %with bootstrap
|
||||
@ -118,18 +120,33 @@ ant
|
||||
%install
|
||||
# jar
|
||||
mkdir -p %{buildroot}%{_javadir}
|
||||
cp -a dist/%{real_name}-%{cvs_version}.jar %{buildroot}%{_javadir}/%{real_name}-%{version}.jar
|
||||
cp -a dist/%{real_name}-%{cvs_version}-runtime.jar %{buildroot}%{_javadir}/%{real_name}-runtime-%{version}.jar
|
||||
(cd %{buildroot}%{_javadir} && for jar in *-%{version}*; do ln -s ${jar} ${jar/-%{version}/}; done)
|
||||
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}
|
||||
install -p -m 755 %{SOURCE1} %{buildroot}%{_bindir}/%{real_name}
|
||||
|
||||
%jpackage_script java_cup.Main "" "" %{real_name}:%{real_name}-runtime %{real_name}
|
||||
|
||||
%if %with bootstrap
|
||||
%files
|
||||
%doc changelog.txt license.txt
|
||||
%{_javadir}/%{real_name}*.jar
|
||||
%else
|
||||
|
||||
%files -f .mfiles
|
||||
%endif
|
||||
%license licence.txt
|
||||
%doc changelog.txt
|
||||
%attr(0755,root,root) %{_bindir}/%{real_name}
|
||||
%{_javadir}/*
|
||||
%{_javadir}/java_cup*.jar
|
||||
|
||||
%if %without bootstrap
|
||||
%files manual
|
||||
%doc manual.html
|
||||
|
BIN
java-cup-d69c832.tar.xz
(Stored with Git LFS)
Normal file
BIN
java-cup-d69c832.tar.xz
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d5c01e033aede7be297485de7d10b1c923f6f1268d4c679d8939285a03027dde
|
||||
size 16878
|
3
java-cup-generated-files.tar.xz
Normal file
3
java-cup-generated-files.tar.xz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c288990c111b2787c169e311c14dd581a03da84e4a9c1bf75702dbd8a1e879a9
|
||||
size 17780
|
397
java-cup-java8.patch
Normal file
397
java-cup-java8.patch
Normal 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 += "}";
|
||||
|
@ -1,18 +0,0 @@
|
||||
--- develop/src/java_cup/runtime/lr_parser.java 2006-03-28 14:34:53.000000000 +0300
|
||||
+++ develop/src/java_cup/runtime/lr_parser.java.f 2007-06-23 11:01:53.000000000 +0300
|
||||
@@ -121,6 +121,7 @@
|
||||
* Simple constructor.
|
||||
*/
|
||||
public lr_parser() {
|
||||
+ symbolFactory = new DefaultSymbolFactory();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -133,7 +134,6 @@
|
||||
* Constructor that sets the default scanner and a SymbolFactory
|
||||
*/
|
||||
public lr_parser(Scanner s, SymbolFactory symfac) {
|
||||
- this(); // in case default constructor someday does something
|
||||
symbolFactory = symfac;
|
||||
setScanner(s);
|
||||
}
|
@ -1,10 +1,15 @@
|
||||
--- develop/build.xml.orig 2006-09-09 06:43:37.000000000 +0200
|
||||
+++ develop/build.xml 2006-09-09 06:45:08.000000000 +0200
|
||||
@@ -62,7 +62,6 @@
|
||||
<jar jarfile="${dist}/java-cup-11a.jar" basedir="${classes}">
|
||||
--- 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-11a-runtime.jar" />
|
||||
- <attribute name="Class-Path" value="java-cup-11b-runtime.jar" />
|
||||
</manifest>
|
||||
</jar>
|
||||
<jar jarfile="${dist}/java-cup-11a-runtime.jar" basedir="${classes}" includes="java_cup/runtime/*">
|
||||
<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">
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- develop/build.xml.orig 2006-09-09 06:43:37.000000000 +0200
|
||||
+++ develop/build.xml 2006-09-09 06:44:10.000000000 +0200
|
||||
@@ -40,18 +40,7 @@
|
||||
--- a/build.xml
|
||||
+++ b/build.xml
|
||||
@@ -44,18 +44,7 @@
|
||||
<delete dir="${dist}" />
|
||||
</target>
|
||||
|
||||
@ -17,6 +17,6 @@
|
||||
-
|
||||
- <target name="compile" depends="jflex">
|
||||
+ <target name="compile">
|
||||
<copy todir="${java}"><fileset dir="${src}"></fileset></copy>
|
||||
<javac srcdir="${java}" destdir="${classes}" verbose="off" listfiles="off" debug="on" source="1.2" target="1.2">
|
||||
<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
60
java-cup-nogit.patch.in
Normal 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@)";
|
||||
|
||||
/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
|
||||
|
@ -1,26 +0,0 @@
|
||||
CUP Parser Generator Copyright Notice, License, and Disclaimer
|
||||
Copyright 1996-1999 by Scott Hudson, Frank Flannery, C. Scott Ananian
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted, provided that
|
||||
the above copyright notice appear in all copies and that both the copyright
|
||||
notice and this permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the names of the authors or their employers not be used
|
||||
in advertising or publicity pertaining to distribution of the software without
|
||||
specific, written prior permission.
|
||||
|
||||
The authors and their employers disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability and fitness. In
|
||||
no event shall the authors or their employers be liable for any special,
|
||||
indirect or consequential damages or any damages whatsoever resulting from loss
|
||||
of use, data or profits, whether in an action of contract, negligence or other
|
||||
tortious action, arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
This is an open source license. It is also GPL-Compatible (see entry for
|
||||
"Standard ML of New Jersey"). The portions of CUP output which are hard-coded
|
||||
into the CUP source code are (naturally) covered by this same license, as is
|
||||
the CUP runtime code linked with the generated parser.
|
||||
|
||||
Java is a trademark of Sun Microsystems, Inc. References to the Java
|
||||
programming language in relation to JLex are not meant to imply that Sun
|
||||
endorses this product.
|
@ -1,27 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# java-cup script
|
||||
# JPackage Project <http://www.jpackage.org/>
|
||||
|
||||
# Source functions library
|
||||
if [ -f /usr/share/java-utils/java-functions ] ; then
|
||||
. /usr/share/java-utils/java-functions
|
||||
else
|
||||
echo "Can't find functions library, aborting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Configuration
|
||||
MAIN_CLASS="java_cup.Main"
|
||||
BASE_FLAGS=""
|
||||
BASE_OPTIONS=""
|
||||
BASE_JARS="java-cup java-cup-runtime"
|
||||
|
||||
# Set parameters
|
||||
set_jvm
|
||||
set_classpath $BASE_JARS
|
||||
set_flags $BASE_FLAGS
|
||||
set_options $BASE_OPTIONS
|
||||
|
||||
# Let's start
|
||||
run "$@"
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package java-cup
|
||||
#
|
||||
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
# 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
|
||||
@ -17,8 +17,10 @@
|
||||
|
||||
|
||||
%global _without_bootstrap 1
|
||||
%define cvs_version 11a
|
||||
%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
|
||||
@ -26,28 +28,29 @@ Release: 0
|
||||
Summary: LALR Parser Generator in Java
|
||||
License: HPND
|
||||
Group: Development/Libraries/Java
|
||||
Url: http://www2.cs.tum.edu/projects/cup/
|
||||
# https://www2.in.tum.de/WebSVN/dl.php?repname=CUP&path=/develop/&rev=0&isdir=1
|
||||
Source0: develop.tar.bz2
|
||||
Source1: java-cup.script
|
||||
Source2: java-cup-generated-files.tar.bz2
|
||||
# From http://www2.cs.tum.edu/projects/cup/
|
||||
Source3: java-cup.license
|
||||
Patch1: java-cup-no-classpath-in-manifest.patch
|
||||
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
|
||||
# Missing symbolFactory initialization in lr_parser, causes sinjdoc to crash
|
||||
Patch4: java-cup-lr_parser-constructor.patch
|
||||
BuildRequires: ant
|
||||
BuildRequires: java-devel
|
||||
BuildRequires: javapackages-tools
|
||||
BuildRequires: xml-commons-apis-bootstrap
|
||||
BuildRequires: xml-commons-resolver-bootstrap
|
||||
#!BuildIgnore: xml-commons-apis xml-commons-resolver xalan-j2 xerces-j2
|
||||
#!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
|
||||
%endif
|
||||
# bootstrap variant is just stripped down java-cup, so it conflicts
|
||||
@ -91,19 +94,18 @@ java-cup is a LALR Parser Generator in Java. With v0.11, you can: *
|
||||
%endif
|
||||
|
||||
%prep
|
||||
%setup -q -n develop
|
||||
%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 2 -n develop
|
||||
%setup -q -T -D -a 1 -n %{real_name}-%{git_hash}
|
||||
%patch2 -p1
|
||||
%else
|
||||
%{_bindir}/find . -name '*.jar' | %{_bindir}/xargs rm
|
||||
%patch3 -p1
|
||||
%endif
|
||||
%patch4 -p1
|
||||
perl -pi -e 's/1\.2/1.6/g' build.xml
|
||||
mkdir -p classes dist
|
||||
cp %{SOURCE3} license.txt
|
||||
mkdir -p target/classes
|
||||
|
||||
%build
|
||||
%if %with bootstrap
|
||||
@ -117,18 +119,33 @@ ant
|
||||
%install
|
||||
# jar
|
||||
mkdir -p %{buildroot}%{_javadir}
|
||||
cp -a dist/%{real_name}-%{cvs_version}.jar %{buildroot}%{_javadir}/%{real_name}-%{version}.jar
|
||||
cp -a dist/%{real_name}-%{cvs_version}-runtime.jar %{buildroot}%{_javadir}/%{real_name}-runtime-%{version}.jar
|
||||
(cd %{buildroot}%{_javadir} && for jar in *-%{version}*; do ln -s ${jar} ${jar/-%{version}/}; done)
|
||||
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}
|
||||
install -p -m 755 %{SOURCE1} %{buildroot}%{_bindir}/%{real_name}
|
||||
|
||||
%jpackage_script java_cup.Main "" "" %{real_name}:%{real_name}-runtime %{real_name}
|
||||
|
||||
%if %with bootstrap
|
||||
%files
|
||||
%doc changelog.txt license.txt
|
||||
%{_javadir}/%{real_name}*.jar
|
||||
%else
|
||||
|
||||
%files -f .mfiles
|
||||
%endif
|
||||
%license licence.txt
|
||||
%doc changelog.txt
|
||||
%attr(0755,root,root) %{_bindir}/%{real_name}
|
||||
%{_javadir}/*
|
||||
%{_javadir}/java_cup*.jar
|
||||
|
||||
%if %without bootstrap
|
||||
%files manual
|
||||
%doc manual.html
|
||||
|
Loading…
x
Reference in New Issue
Block a user