#1 Add Debian patches.
Merged 5 years ago by jjames. Opened 5 years ago by jjames.
Unknown source master  into  master

@@ -0,0 +1,14 @@

+ Description: Increase the default conversion timeout to avoid build failures when complex grammars are processed on slow architectures.

+ Author: Emmanuel Bourg <ebourg@apache.org>

+ Forwarded: no

+ --- a/tool/src/main/java/org/antlr/analysis/DFA.java

+ +++ b/tool/src/main/java/org/antlr/analysis/DFA.java

+ @@ -57,7 +57,7 @@

+  	 */

+  

+  	/** Set to 0 to not terminate early (time in ms) */

+ -	public static int MAX_TIME_PER_DFA_CREATION = 1*1000;

+ +	public static int MAX_TIME_PER_DFA_CREATION = 30*1000;

+  

+  	/** How many edges can each DFA state have before a "special" state

+  	 *  is created that uses IF expressions instead of a table?

@@ -0,0 +1,35 @@

+ Description: Fix various issues with the C template (backports of patchs proposed upstream)

+ Origin: backport, https://github.com/stephengaito/antlr3/commit/adc5e54

+                   https://github.com/stephengaito/antlr3/commit/71df80c

+ --- a/tool/src/main/resources/org/antlr/codegen/templates/C/C.stg

+ +++ b/tool/src/main/resources/org/antlr/codegen/templates/C/C.stg

+ @@ -2132,7 +2132,9 @@

+  <if(LEXER)>

+      LRECOVER();

+  <else>

+ +<! use following code to make it recover inline;

+      RECOVERFROMMISMATCHEDSET(&FOLLOW_set_in_<ruleName><elementIndex>);

+ +!>

+  <endif>

+      goto rule<ruleDescriptor.name>Ex;

+  }<\n>

+ @@ -2143,7 +2145,10 @@

+  EXCEPTION->type         = ANTLR3_MISMATCHED_SET_EXCEPTION;

+  EXCEPTION->name         = (void *)ANTLR3_MISMATCHED_SET_NAME;

+  <if(PARSER)>

+ +EXCEPTION->expectingSet = NULL;

+ +<! use following code to make it recover inline;

+  EXCEPTION->expectingSet = &FOLLOW_set_in_<ruleName><elementIndex>;

+ +!>

+  <endif>

+  >>

+  

+ @@ -2510,7 +2515,7 @@

+   */

+  static const ANTLR3_INT32 * const dfa<dfa.decisionNumber>_transitions[] =

+  {

+ -    <dfa.transitionEdgeTables:{xref|dfa<dfa.decisionNumber>_T<xref>}; separator=", ", wrap="\n", null="_empty">

+ +    <dfa.transitionEdgeTables:{xref|dfa<dfa.decisionNumber>_T<xref>}; separator=", ", wrap="\n", null="NULL">

+  };

+  

+  <if(dfa.specialStateSTs)>

file added
+13
@@ -0,0 +1,13 @@

+ Description: Keep the Token.EOF_TOKEN field to preserve the backward compatibility

+ Author: Emmanuel Bourg <ebourg@apache.org>

+ Forwarded: no

+ --- a/runtime/Java/src/main/java/org/antlr/runtime/Token.java

+ +++ b/runtime/Java/src/main/java/org/antlr/runtime/Token.java

+ @@ -38,6 +38,7 @@

+  	public static final int MIN_TOKEN_TYPE = UP+1;

+  

+      public static final int EOF = CharStream.EOF;

+ +    public static final Token EOF_TOKEN = new CommonToken(EOF);

+  

+  	public static final int INVALID_TOKEN_TYPE = 0;

+  	public static final Token INVALID_TOKEN = new CommonToken(INVALID_TOKEN_TYPE);

@@ -0,0 +1,42 @@

+ Description: Replace the HashSets with LinkedHashSets to make the generated parsers reproducible

+ Author: Emmanuel Bourg <ebourg@apache.org>

+ Forwarded: no

+ --- a/tool/src/main/antlr3/org/antlr/grammar/v3/DefineGrammarItemsWalker.g

+ +++ b/tool/src/main/antlr3/org/antlr/grammar/v3/DefineGrammarItemsWalker.g

+ @@ -45,6 +45,7 @@

+  package org.antlr.grammar.v3;

+  import org.antlr.tool.*;

+  import java.util.HashSet;

+ +import java.util.LinkedHashSet;

+  import java.util.Set;

+  }

+  

+ @@ -279,7 +280,7 @@

+  throwsSpec returns [HashSet<String> exceptions]

+  @init

+  {

+ -	$exceptions = new HashSet<String>();

+ +	$exceptions = new LinkedHashSet<String>();

+  }

+  	:	^('throws' (ID {$exceptions.add($ID.text);})+ )

+  	;

+ @@ -556,7 +557,7 @@

+  	if ( state.backtracking == 0 )

+  	{

+  		if ( grammar.buildAST() )

+ -			currentRewriteRule.rewriteRefsDeep = new HashSet<GrammarAST>();

+ +			currentRewriteRule.rewriteRefsDeep = new LinkedHashSet<GrammarAST>();

+  	}

+  }

+  	:	^(	REWRITES

+ @@ -582,8 +583,8 @@

+  	{

+  		// don't do if guessing

+  		currentRewriteBlock=$start; // pts to BLOCK node

+ -		currentRewriteBlock.rewriteRefsShallow = new HashSet<GrammarAST>();

+ -		currentRewriteBlock.rewriteRefsDeep = new HashSet<GrammarAST>();

+ +		currentRewriteBlock.rewriteRefsShallow = new LinkedHashSet<GrammarAST>();

+ +		currentRewriteBlock.rewriteRefsDeep = new LinkedHashSet<GrammarAST>();

+  	}

+  }

+  	:   ^( BLOCK rewrite_alternative EOB )

file modified
+17 -1
@@ -1,7 +1,7 @@

  %global antlr_version 3.5.2

  %global c_runtime_version 3.4

  %global javascript_runtime_version 3.1

- %global baserelease 21

+ %global baserelease 22

  

  Summary:            ANother Tool for Language Recognition

  Name:               antlr3
@@ -18,6 +18,15 @@

  Patch0:             0001-java8-fix.patch

  # Generate OSGi metadata

  Patch1:         osgi-manifest.patch

+ # Increase the default conversion timeout to avoid build failures when complex

+ # grammars are processed on slow architectures.  Patch from Debian.

+ Patch2:         0002-conversion-timeout.patch

+ # Fix problems with the C template.  Patch from Debian.

+ Patch3:         0003-fix-c-template.patch

+ # Keep Token.EOF_TOKEN for backwards compatibility.  Patch from Debian.

+ Patch4:         0004-eof-token.patch

+ # Make parsers reproducible.  Patch from Debian.

+ Patch5:         0005-reproducible-parsers.patch

  

  BuildRequires:  maven-local

  BuildRequires:  mvn(org.antlr:antlr)
@@ -130,6 +139,10 @@

  sed -i "s,\${buildNumber},`cat %{_sysconfdir}/fedora-release` `date`," tool/src/main/resources/org/antlr/antlr.properties

  %patch0 -p1

  %patch1

+ %patch2 -p1

+ %patch3 -p1

+ %patch4 -p1

+ %patch5 -p1

  

  # remove pre-built artifacts

  find -type f -a -name *.jar -delete
@@ -263,6 +276,9 @@

  %doc tool/LICENSE.txt

  

  %changelog

+ * Sat Apr 27 2019 Jerry James <loganjerry@gmail.com> - 1:3.5.2-22

+ - Add Debian patches

+ 

  * Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1:3.5.2-21

  - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

  

The cvc4 package currently fails to build due to bugs in the antlr3 C template, namely use of an undefined "_empty" symbol and failure to compute follow sets correctly. I looked to see if anybody else had encountered the problem, and found that Debian had a patch to fix it. They have a few other patches which also improve antlr3 in various ways. This pull request adds those patches.

What is the upstream status of those? I see at least one of them is a backport.

An obligatory question: @jjames, would you like to maintain antlr3?

Upstream is no longer maintaining antlr3, so none of those patches will ever be applied. Upstream wants everyone to switch to antlr4. I have communicated this to cvc4 upstream. They say they will work on it .... sometime.

As for maintaining antlr3, I already have a heavier package load than I can really handle. I am not eager to pick up more packages, especially since I am already going to have to add about another half dozen just to get my current packages up to their latest versions. Nevertheless, if the choice is between maintaining antlr3 and letting it be removed from Fedora, I suppose I could be the maintainer of record. I probably wouldn't do much in the way of actual maintenance, though.

I probably wouldn't do much in the way of actual maintenance, though.

We (Stewardship SIG) don't either. Franky, I doubt we even have capacity to review the patches here.

Very well. Give me ownership of the package and I'll do what I can.

Done. Thanks a lot for picking it up!

Pull-Request has been merged by jjames

5 years ago