diff --git a/Antlr4.Runtime/Atn/ParserATNSimulator.cs b/Antlr4.Runtime/Atn/ParserATNSimulator.cs index fe8735f9e..892e51c47 100644 --- a/Antlr4.Runtime/Atn/ParserATNSimulator.cs +++ b/Antlr4.Runtime/Atn/ParserATNSimulator.cs @@ -328,7 +328,7 @@ namespace Antlr4.Runtime.Atn != null && !atn.decisionToState[decision].sll); if (outerContext == null) { - outerContext = ParserRuleContext.EmptyContext(); + outerContext = ParserRuleContext.EmptyContext; } SimulatorState state = null; if (!dfa.IsEmpty()) @@ -397,7 +397,7 @@ namespace Antlr4.Runtime.Atn { if (outerContext == null) { - outerContext = ParserRuleContext.EmptyContext(); + outerContext = ParserRuleContext.EmptyContext; } int alt = 0; int m = input.Mark(); diff --git a/Antlr4.Runtime/Atn/SemanticContext.cs b/Antlr4.Runtime/Atn/SemanticContext.cs index a0a53e2bc..888cf39d1 100644 --- a/Antlr4.Runtime/Atn/SemanticContext.cs +++ b/Antlr4.Runtime/Atn/SemanticContext.cs @@ -27,6 +27,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using System; using System.Collections.Generic; using Antlr4.Runtime; using Antlr4.Runtime.Atn; diff --git a/Antlr4.Runtime/Atn/SimulatorState.cs b/Antlr4.Runtime/Atn/SimulatorState.cs index 70bbc011b..0880eff01 100644 --- a/Antlr4.Runtime/Atn/SimulatorState.cs +++ b/Antlr4.Runtime/Atn/SimulatorState.cs @@ -47,8 +47,7 @@ namespace Antlr4.Runtime.Atn public SimulatorState(ParserRuleContext outerContext, DFAState s0, bool useContext , ParserRuleContext remainingOuterContext) { - this.outerContext = outerContext != null ? outerContext : ParserRuleContext.EmptyContext - (); + this.outerContext = outerContext != null ? outerContext : ParserRuleContext.EmptyContext; this.s0 = s0; this.useContext = useContext; this.remainingOuterContext = remainingOuterContext; diff --git a/Antlr4.Runtime/ParserRuleContext.cs b/Antlr4.Runtime/ParserRuleContext.cs index 612fed87a..2a9106bdf 100644 --- a/Antlr4.Runtime/ParserRuleContext.cs +++ b/Antlr4.Runtime/ParserRuleContext.cs @@ -137,10 +137,13 @@ namespace Antlr4.Runtime { } - // public List states; - public static Antlr4.Runtime.ParserRuleContext EmptyContext() + public static Antlr4.Runtime.ParserRuleContext EmptyContext { - return Empty; + get + { + // public List states; + return Empty; + } } /// COPY a ctx (I'm deliberately not using copy constructor) @@ -368,14 +371,20 @@ namespace Antlr4.Runtime } } - public virtual IToken GetStart() + public virtual IToken Start { - return start; + get + { + return start; + } } - public virtual IToken GetStop() + public virtual IToken Stop { - return stop; + get + { + return stop; + } } /// Used for rule context info debugging during parse-time, not so much for ATN debugging diff --git a/Antlr4.Runtime/RuleContext.cs b/Antlr4.Runtime/RuleContext.cs index 86b43d8ed..fa7f9c231 100644 --- a/Antlr4.Runtime/RuleContext.cs +++ b/Antlr4.Runtime/RuleContext.cs @@ -268,7 +268,7 @@ namespace Antlr4.Runtime public string ToString<_T0>(Recognizer<_T0> recog) { - return ToString(recog, ParserRuleContext.EmptyContext()); + return ToString(recog, ParserRuleContext.EmptyContext); } public string ToString(IList ruleNames) diff --git a/reference/antlr4 b/reference/antlr4 index 6743730f6..7cb2b4c68 160000 --- a/reference/antlr4 +++ b/reference/antlr4 @@ -1 +1 @@ -Subproject commit 6743730f698969a938bec3ec2c42c4728a97256c +Subproject commit 7cb2b4c6841ec131fadca8e294668113943b91a4 diff --git a/reference/sharpen-all-options.txt b/reference/sharpen-all-options.txt index 7b24e9920..52377cbdc 100644 --- a/reference/sharpen-all-options.txt +++ b/reference/sharpen-all-options.txt @@ -99,6 +99,7 @@ -methodMapping java.io.IOException.IOException(java.lang.Throwable) Sharpen.Extensions.CreateIOException -fieldMapping java.util.Locale.US InvariantCulture -typeMapping java.lang.Comparable System.IComparable +-typeMapping java.lang.Comparable<> System.IComparable -typeMapping java.util.Comparator<> System.Collections.Generic.IComparer -typeMapping java.util.HashSet<> System.Collections.Generic.HashSet -typeMapping java.util.Set<> System.Collections.Generic.ISet