forked from jasder/antlr
Updated working build of Sharpen
This commit is contained in:
parent
fcf2482ab3
commit
bf070cf58f
|
@ -1 +1 @@
|
|||
Subproject commit f01e18ba72eda0825e09da106ff9c9e7c337cd22
|
||||
Subproject commit ee88c0a13113436b09009d8f621333e239ac926f
|
|
@ -43,7 +43,8 @@ namespace Antlr4.Runtime
|
|||
protected internal string fileName;
|
||||
|
||||
/// <exception cref="System.IO.IOException"></exception>
|
||||
public AntlrFileStream(string fileName) : this(fileName, null)
|
||||
public AntlrFileStream(string fileName)
|
||||
: this(fileName, null)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -88,14 +88,14 @@ namespace Antlr4.Runtime
|
|||
}
|
||||
|
||||
/// <exception cref="System.IO.IOException"></exception>
|
||||
public AntlrInputStream(StreamReader r) : this(r, InitialBufferSize, ReadBufferSize
|
||||
)
|
||||
public AntlrInputStream(StreamReader r)
|
||||
: this(r, InitialBufferSize, ReadBufferSize)
|
||||
{
|
||||
}
|
||||
|
||||
/// <exception cref="System.IO.IOException"></exception>
|
||||
public AntlrInputStream(StreamReader r, int initialSize) : this(r, initialSize, ReadBufferSize
|
||||
)
|
||||
public AntlrInputStream(StreamReader r, int initialSize)
|
||||
: this(r, initialSize, ReadBufferSize)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -106,20 +106,20 @@ namespace Antlr4.Runtime
|
|||
}
|
||||
|
||||
/// <exception cref="System.IO.IOException"></exception>
|
||||
public AntlrInputStream(Stream input) : this(new StreamReader(input), InitialBufferSize
|
||||
)
|
||||
public AntlrInputStream(Stream input)
|
||||
: this(new StreamReader(input), InitialBufferSize)
|
||||
{
|
||||
}
|
||||
|
||||
/// <exception cref="System.IO.IOException"></exception>
|
||||
public AntlrInputStream(Stream input, int initialSize) : this(new StreamReader(input
|
||||
), initialSize)
|
||||
public AntlrInputStream(Stream input, int initialSize)
|
||||
: this(new StreamReader(input), initialSize)
|
||||
{
|
||||
}
|
||||
|
||||
/// <exception cref="System.IO.IOException"></exception>
|
||||
public AntlrInputStream(Stream input, int initialSize, int readChunkSize) : this(
|
||||
new StreamReader(input), initialSize, readChunkSize)
|
||||
public AntlrInputStream(Stream input, int initialSize, int readChunkSize)
|
||||
: this(new StreamReader(input), initialSize, readChunkSize)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -501,15 +501,15 @@ namespace Antlr4.Runtime.Atn
|
|||
private readonly Antlr4.Runtime.Atn.SemanticContext semanticContext;
|
||||
|
||||
public SemanticContextATNConfig(Antlr4.Runtime.Atn.SemanticContext semanticContext
|
||||
, ATNState state, int alt, PredictionContext context) : base(state, alt, context
|
||||
)
|
||||
, ATNState state, int alt, PredictionContext context)
|
||||
: base(state, alt, context)
|
||||
{
|
||||
this.semanticContext = semanticContext;
|
||||
}
|
||||
|
||||
public SemanticContextATNConfig(Antlr4.Runtime.Atn.SemanticContext semanticContext
|
||||
, ATNConfig c, ATNState state, PredictionContext context) : base(c, state, context
|
||||
)
|
||||
, ATNConfig c, ATNState state, PredictionContext context)
|
||||
: base(c, state, context)
|
||||
{
|
||||
this.semanticContext = semanticContext;
|
||||
}
|
||||
|
@ -528,13 +528,15 @@ namespace Antlr4.Runtime.Atn
|
|||
private readonly int actionIndex;
|
||||
|
||||
public ActionATNConfig(int actionIndex, ATNState state, int alt, PredictionContext
|
||||
context) : base(state, alt, context)
|
||||
context)
|
||||
: base(state, alt, context)
|
||||
{
|
||||
this.actionIndex = actionIndex;
|
||||
}
|
||||
|
||||
protected internal ActionATNConfig(int actionIndex, ATNConfig c, ATNState state,
|
||||
PredictionContext context) : base(c, state, context)
|
||||
PredictionContext context)
|
||||
: base(c, state, context)
|
||||
{
|
||||
if (c.SemanticContext != SemanticContext.None)
|
||||
{
|
||||
|
@ -557,15 +559,15 @@ namespace Antlr4.Runtime.Atn
|
|||
private readonly int actionIndex;
|
||||
|
||||
public ActionSemanticContextATNConfig(int actionIndex, SemanticContext semanticContext
|
||||
, ATNState state, int alt, PredictionContext context) : base(semanticContext,
|
||||
state, alt, context)
|
||||
, ATNState state, int alt, PredictionContext context)
|
||||
: base(semanticContext, state, alt, context)
|
||||
{
|
||||
this.actionIndex = actionIndex;
|
||||
}
|
||||
|
||||
public ActionSemanticContextATNConfig(int actionIndex, SemanticContext semanticContext
|
||||
, ATNConfig c, ATNState state, PredictionContext context) : base(semanticContext
|
||||
, c, state, context)
|
||||
, ATNConfig c, ATNState state, PredictionContext context)
|
||||
: base(semanticContext, c, state, context)
|
||||
{
|
||||
this.actionIndex = actionIndex;
|
||||
}
|
||||
|
|
|
@ -448,13 +448,15 @@ namespace Antlr4.Runtime.Atn
|
|||
return true;
|
||||
}
|
||||
|
||||
public virtual bool AddAll<_T0>(ICollection<_T0> c) where _T0:ATNConfig
|
||||
public virtual bool AddAll<_T0>(ICollection<_T0> c)
|
||||
where _T0 : ATNConfig
|
||||
{
|
||||
return AddAll(c, null);
|
||||
}
|
||||
|
||||
public virtual bool AddAll<_T0>(ICollection<_T0> c, PredictionContextCache contextCache
|
||||
) where _T0:ATNConfig
|
||||
)
|
||||
where _T0 : ATNConfig
|
||||
{
|
||||
EnsureWritable();
|
||||
bool changed = false;
|
||||
|
|
|
@ -35,7 +35,8 @@ namespace Antlr4.Runtime.Atn
|
|||
/// <author>Sam Harwell</author>
|
||||
public abstract class AbstractPredicateTransition : Transition
|
||||
{
|
||||
public AbstractPredicateTransition(ATNState target) : base(target)
|
||||
public AbstractPredicateTransition(ATNState target)
|
||||
: base(target)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,13 +40,14 @@ namespace Antlr4.Runtime.Atn
|
|||
|
||||
public readonly bool isCtxDependent;
|
||||
|
||||
public ActionTransition(ATNState target, int ruleIndex) : this(target, ruleIndex,
|
||||
-1, false)
|
||||
public ActionTransition(ATNState target, int ruleIndex)
|
||||
: this(target, ruleIndex, -1, false)
|
||||
{
|
||||
}
|
||||
|
||||
public ActionTransition(ATNState target, int ruleIndex, int actionIndex, bool isCtxDependent
|
||||
) : base(target)
|
||||
)
|
||||
: base(target)
|
||||
{
|
||||
// e.g., $i ref in action
|
||||
this.ruleIndex = ruleIndex;
|
||||
|
|
|
@ -43,8 +43,8 @@ namespace Antlr4.Runtime.Atn
|
|||
[NotNull]
|
||||
public readonly int[] returnStates;
|
||||
|
||||
internal ArrayPredictionContext(PredictionContext[] parents, int[] returnStates) :
|
||||
base(CalculateHashCode(parents, returnStates))
|
||||
internal ArrayPredictionContext(PredictionContext[] parents, int[] returnStates)
|
||||
: base(CalculateHashCode(parents, returnStates))
|
||||
{
|
||||
System.Diagnostics.Debug.Assert(parents.Length == returnStates.Length);
|
||||
System.Diagnostics.Debug.Assert(returnStates.Length > 1 || returnStates[0] != EmptyFullStateKey
|
||||
|
@ -54,7 +54,8 @@ namespace Antlr4.Runtime.Atn
|
|||
}
|
||||
|
||||
internal ArrayPredictionContext(PredictionContext[] parents, int[] returnStates,
|
||||
int hashCode) : base(hashCode)
|
||||
int hashCode)
|
||||
: base(hashCode)
|
||||
{
|
||||
System.Diagnostics.Debug.Assert(parents.Length == returnStates.Length);
|
||||
System.Diagnostics.Debug.Assert(returnStates.Length > 1 || returnStates[0] != EmptyFullStateKey
|
||||
|
|
|
@ -40,7 +40,8 @@ namespace Antlr4.Runtime.Atn
|
|||
/// <remarks>The token type or character value; or, signifies special label.</remarks>
|
||||
public readonly int label;
|
||||
|
||||
public AtomTransition(ATNState target, int label) : base(target)
|
||||
public AtomTransition(ATNState target, int label)
|
||||
: base(target)
|
||||
{
|
||||
this.label = label;
|
||||
}
|
||||
|
|
|
@ -44,7 +44,8 @@ namespace Antlr4.Runtime.Atn
|
|||
|
||||
private readonly bool fullContext;
|
||||
|
||||
private EmptyPredictionContext(bool fullContext) : base(CalculateEmptyHashCode())
|
||||
private EmptyPredictionContext(bool fullContext)
|
||||
: base(CalculateEmptyHashCode())
|
||||
{
|
||||
this.fullContext = fullContext;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,8 @@ namespace Antlr4.Runtime.Atn
|
|||
{
|
||||
public sealed class EpsilonTransition : Transition
|
||||
{
|
||||
public EpsilonTransition(ATNState target) : base(target)
|
||||
public EpsilonTransition(ATNState target)
|
||||
: base(target)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -115,11 +115,13 @@ namespace Antlr4.Runtime.Atn
|
|||
|
||||
public static int match_calls = 0;
|
||||
|
||||
public LexerATNSimulator(ATN atn) : this(null, atn)
|
||||
public LexerATNSimulator(ATN atn)
|
||||
: this(null, atn)
|
||||
{
|
||||
}
|
||||
|
||||
public LexerATNSimulator(Lexer recog, ATN atn) : base(atn)
|
||||
public LexerATNSimulator(Lexer recog, ATN atn)
|
||||
: base(atn)
|
||||
{
|
||||
this.recog = recog;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,8 @@ namespace Antlr4.Runtime.Atn
|
|||
{
|
||||
public sealed class NotSetTransition : SetTransition
|
||||
{
|
||||
public NotSetTransition(ATNState target, IntervalSet set) : base(target, set)
|
||||
public NotSetTransition(ATNState target, IntervalSet set)
|
||||
: base(target, set)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -39,8 +39,8 @@ namespace Antlr4.Runtime.Atn
|
|||
{
|
||||
}
|
||||
|
||||
public OrderedATNConfigSet(ATNConfigSet set, bool @readonly) : base(set, @readonly
|
||||
)
|
||||
public OrderedATNConfigSet(ATNConfigSet set, bool @readonly)
|
||||
: base(set, @readonly)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -265,11 +265,13 @@ namespace Antlr4.Runtime.Atn
|
|||
protected internal bool userWantsCtxSensitive = true;
|
||||
|
||||
/// <summary>Testing only!</summary>
|
||||
public ParserATNSimulator(ATN atn) : this(null, atn)
|
||||
public ParserATNSimulator(ATN atn)
|
||||
: this(null, atn)
|
||||
{
|
||||
}
|
||||
|
||||
public ParserATNSimulator(Parser parser, ATN atn) : base(atn)
|
||||
public ParserATNSimulator(Parser parser, ATN atn)
|
||||
: base(atn)
|
||||
{
|
||||
this.parser = parser;
|
||||
}
|
||||
|
|
|
@ -37,8 +37,8 @@ namespace Antlr4.Runtime.Atn
|
|||
{
|
||||
public readonly int precedence;
|
||||
|
||||
public PrecedencePredicateTransition(ATNState target, int precedence) : base(target
|
||||
)
|
||||
public PrecedencePredicateTransition(ATNState target, int precedence)
|
||||
: base(target)
|
||||
{
|
||||
this.precedence = precedence;
|
||||
}
|
||||
|
|
|
@ -53,7 +53,8 @@ namespace Antlr4.Runtime.Atn
|
|||
public readonly bool isCtxDependent;
|
||||
|
||||
public PredicateTransition(ATNState target, int ruleIndex, int predIndex, bool isCtxDependent
|
||||
) : base(target)
|
||||
)
|
||||
: base(target)
|
||||
{
|
||||
// e.g., $i ref in pred
|
||||
this.ruleIndex = ruleIndex;
|
||||
|
|
|
@ -523,8 +523,8 @@ outer_break: ;
|
|||
public sealed class IdentityHashMap : Dictionary<PredictionContext, PredictionContext
|
||||
>
|
||||
{
|
||||
public IdentityHashMap() : base(PredictionContext.IdentityEqualityComparator.Instance
|
||||
)
|
||||
public IdentityHashMap()
|
||||
: base(PredictionContext.IdentityEqualityComparator.Instance)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,7 +59,8 @@ namespace Antlr4.Runtime.Atn
|
|||
|
||||
private readonly bool enableCache;
|
||||
|
||||
public PredictionContextCache() : this(true)
|
||||
public PredictionContextCache()
|
||||
: this(true)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -78,8 +78,8 @@ namespace Antlr4.Runtime.Atn
|
|||
/// <remarks>A Map that uses just the state and the stack context as the key.</remarks>
|
||||
internal class AltAndContextMap : Dictionary<ATNConfig, BitSet>
|
||||
{
|
||||
public AltAndContextMap() : base(PredictionMode.AltAndContextConfigEqualityComparator
|
||||
.Instance)
|
||||
public AltAndContextMap()
|
||||
: base(PredictionMode.AltAndContextConfigEqualityComparator.Instance)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,8 @@ namespace Antlr4.Runtime.Atn
|
|||
|
||||
public readonly int to;
|
||||
|
||||
public RangeTransition(ATNState target, int from, int to) : base(target)
|
||||
public RangeTransition(ATNState target, int from, int to)
|
||||
: base(target)
|
||||
{
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
|
|
|
@ -49,7 +49,8 @@ namespace Antlr4.Runtime.Atn
|
|||
public bool optimizedTailCall;
|
||||
|
||||
public RuleTransition(RuleStartState ruleStart, int ruleIndex, int precedence, ATNState
|
||||
followState) : base(ruleStart)
|
||||
followState)
|
||||
: base(ruleStart)
|
||||
{
|
||||
// no Rule object at runtime
|
||||
this.ruleIndex = ruleIndex;
|
||||
|
|
|
@ -392,7 +392,8 @@ namespace Antlr4.Runtime.Atn
|
|||
}
|
||||
|
||||
private static IList<SemanticContext.PrecedencePredicate> FilterPrecedencePredicates
|
||||
<_T0>(ICollection<_T0> collection) where _T0:SemanticContext
|
||||
<_T0>(ICollection<_T0> collection)
|
||||
where _T0 : SemanticContext
|
||||
{
|
||||
List<SemanticContext.PrecedencePredicate> result = null;
|
||||
for (IEnumerator<SemanticContext> iterator = collection.GetEnumerator(); iterator
|
||||
|
|
|
@ -40,7 +40,8 @@ namespace Antlr4.Runtime.Atn
|
|||
[NotNull]
|
||||
public readonly IntervalSet set;
|
||||
|
||||
public SetTransition(ATNState target, IntervalSet set) : base(target)
|
||||
public SetTransition(ATNState target, IntervalSet set)
|
||||
: base(target)
|
||||
{
|
||||
// TODO (sam): should we really allow null here?
|
||||
if (set == null)
|
||||
|
|
|
@ -40,8 +40,8 @@ namespace Antlr4.Runtime.Atn
|
|||
|
||||
public readonly int returnState;
|
||||
|
||||
internal SingletonPredictionContext(PredictionContext parent, int returnState) :
|
||||
base(CalculateHashCode(parent, returnState))
|
||||
internal SingletonPredictionContext(PredictionContext parent, int returnState)
|
||||
: base(CalculateHashCode(parent, returnState))
|
||||
{
|
||||
System.Diagnostics.Debug.Assert(returnState != EmptyFullStateKey && returnState !=
|
||||
EmptyLocalStateKey);
|
||||
|
|
|
@ -35,7 +35,8 @@ namespace Antlr4.Runtime.Atn
|
|||
{
|
||||
public sealed class WildcardTransition : Transition
|
||||
{
|
||||
public WildcardTransition(ATNState target) : base(target)
|
||||
public WildcardTransition(ATNState target)
|
||||
: base(target)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -38,8 +38,8 @@ namespace Antlr4.Runtime
|
|||
public class BaseErrorListener : IParserErrorListener
|
||||
{
|
||||
public virtual void SyntaxError<T>(Recognizer<T, object> recognizer, T offendingSymbol
|
||||
, int line, int charPositionInLine, string msg, RecognitionException e) where
|
||||
T:IToken
|
||||
, int line, int charPositionInLine, string msg, RecognitionException e)
|
||||
where T : IToken
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -60,13 +60,14 @@ namespace Antlr4.Runtime
|
|||
this.copyText = copyText;
|
||||
}
|
||||
|
||||
public CommonTokenFactory() : this(false)
|
||||
public CommonTokenFactory()
|
||||
: this(false)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual CommonToken Create<_T0>(Tuple<_T0> source, int type, string text,
|
||||
int channel, int start, int stop, int line, int charPositionInLine) where _T0:
|
||||
ITokenSource
|
||||
int channel, int start, int stop, int line, int charPositionInLine)
|
||||
where _T0 : ITokenSource
|
||||
{
|
||||
CommonToken t = new CommonToken(source, type, channel, start, stop);
|
||||
t.Line = line;
|
||||
|
|
|
@ -66,12 +66,13 @@ namespace Antlr4.Runtime
|
|||
/// </remarks>
|
||||
protected internal int channel = TokenConstants.DefaultChannel;
|
||||
|
||||
public CommonTokenStream(ITokenSource tokenSource) : base(tokenSource)
|
||||
public CommonTokenStream(ITokenSource tokenSource)
|
||||
: base(tokenSource)
|
||||
{
|
||||
}
|
||||
|
||||
public CommonTokenStream(ITokenSource tokenSource, int channel) : this(tokenSource
|
||||
)
|
||||
public CommonTokenStream(ITokenSource tokenSource, int channel)
|
||||
: this(tokenSource)
|
||||
{
|
||||
this.channel = channel;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace Antlr4.Runtime.Dfa
|
|||
public abstract Antlr4.Runtime.Dfa.AbstractEdgeMap<T> Put(int key, T value);
|
||||
|
||||
public virtual Antlr4.Runtime.Dfa.AbstractEdgeMap<T> PutAll<_T0>(IEdgeMap<_T0> m)
|
||||
where _T0:T
|
||||
where _T0 : T
|
||||
{
|
||||
Antlr4.Runtime.Dfa.AbstractEdgeMap<T> result = this;
|
||||
foreach (KeyValuePair<int, T> entry in m.EntrySet())
|
||||
|
|
|
@ -41,7 +41,8 @@ namespace Antlr4.Runtime.Dfa
|
|||
|
||||
private int size;
|
||||
|
||||
public ArrayEdgeMap(int minIndex, int maxIndex) : base(minIndex, maxIndex)
|
||||
public ArrayEdgeMap(int minIndex, int maxIndex)
|
||||
: base(minIndex, maxIndex)
|
||||
{
|
||||
arrayData = (T[])new object[maxIndex - minIndex + 1];
|
||||
}
|
||||
|
|
|
@ -66,7 +66,8 @@ namespace Antlr4.Runtime.Dfa
|
|||
|
||||
private readonly AtomicInteger nextStateNumber = new AtomicInteger();
|
||||
|
||||
public DFA(ATNState atnStartState) : this(atnStartState, 0)
|
||||
public DFA(ATNState atnStartState)
|
||||
: this(atnStartState, 0)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -53,14 +53,14 @@ namespace Antlr4.Runtime.Dfa
|
|||
[Nullable]
|
||||
internal readonly ATN atn;
|
||||
|
||||
public DFASerializer(DFA dfa, string[] tokenNames) : this(dfa, tokenNames, null,
|
||||
null)
|
||||
public DFASerializer(DFA dfa, string[] tokenNames)
|
||||
: this(dfa, tokenNames, null, null)
|
||||
{
|
||||
}
|
||||
|
||||
public DFASerializer(DFA dfa, Recognizer<object, object> parser) : this(dfa, parser
|
||||
!= null ? parser.TokenNames : null, parser != null ? parser.RuleNames : null
|
||||
, parser != null ? parser.Atn : null)
|
||||
public DFASerializer(DFA dfa, Recognizer<object, object> parser)
|
||||
: this(dfa, parser != null ? parser.TokenNames : null, parser != null ? parser.RuleNames
|
||||
: null, parser != null ? parser.Atn : null)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,8 @@ namespace Antlr4.Runtime.Dfa
|
|||
IEdgeMap<T> Remove(int key);
|
||||
|
||||
[NotNull]
|
||||
IEdgeMap<T> PutAll<_T0>(IEdgeMap<_T0> m) where _T0:T;
|
||||
IEdgeMap<T> PutAll<_T0>(IEdgeMap<_T0> m)
|
||||
where _T0 : T;
|
||||
|
||||
[NotNull]
|
||||
IEdgeMap<T> Clear();
|
||||
|
|
|
@ -35,7 +35,8 @@ namespace Antlr4.Runtime.Dfa
|
|||
{
|
||||
public class LexerDFASerializer : DFASerializer
|
||||
{
|
||||
public LexerDFASerializer(DFA dfa) : base(dfa, (string[])null)
|
||||
public LexerDFASerializer(DFA dfa)
|
||||
: base(dfa, (string[])null)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -40,14 +40,15 @@ namespace Antlr4.Runtime.Dfa
|
|||
|
||||
private readonly T value;
|
||||
|
||||
public SingletonEdgeMap(int minIndex, int maxIndex) : base(minIndex, maxIndex)
|
||||
public SingletonEdgeMap(int minIndex, int maxIndex)
|
||||
: base(minIndex, maxIndex)
|
||||
{
|
||||
this.key = 0;
|
||||
this.value = null;
|
||||
}
|
||||
|
||||
public SingletonEdgeMap(int minIndex, int maxIndex, int key, T value) : base(minIndex
|
||||
, maxIndex)
|
||||
public SingletonEdgeMap(int minIndex, int maxIndex, int key, T value)
|
||||
: base(minIndex, maxIndex)
|
||||
{
|
||||
if (key >= minIndex && key <= maxIndex)
|
||||
{
|
||||
|
|
|
@ -43,20 +43,20 @@ namespace Antlr4.Runtime.Dfa
|
|||
|
||||
private readonly IList<T> values;
|
||||
|
||||
public SparseEdgeMap(int minIndex, int maxIndex) : this(minIndex, maxIndex, DefaultMaxSize
|
||||
)
|
||||
public SparseEdgeMap(int minIndex, int maxIndex)
|
||||
: this(minIndex, maxIndex, DefaultMaxSize)
|
||||
{
|
||||
}
|
||||
|
||||
public SparseEdgeMap(int minIndex, int maxIndex, int maxSparseSize) : base(minIndex
|
||||
, maxIndex)
|
||||
public SparseEdgeMap(int minIndex, int maxIndex, int maxSparseSize)
|
||||
: base(minIndex, maxIndex)
|
||||
{
|
||||
this.keys = new int[maxSparseSize];
|
||||
this.values = new List<T>(maxSparseSize);
|
||||
}
|
||||
|
||||
private SparseEdgeMap(Antlr4.Runtime.Dfa.SparseEdgeMap<T> map, int maxSparseSize)
|
||||
: base(map.minIndex, map.maxIndex)
|
||||
: base(map.minIndex, map.maxIndex)
|
||||
{
|
||||
if (maxSparseSize < map.values.Count)
|
||||
{
|
||||
|
|
|
@ -74,7 +74,8 @@ namespace Antlr4.Runtime
|
|||
/// which only
|
||||
/// reports exact ambiguities.
|
||||
/// </summary>
|
||||
public DiagnosticErrorListener() : this(true)
|
||||
public DiagnosticErrorListener()
|
||||
: this(true)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -136,7 +137,8 @@ namespace Antlr4.Runtime
|
|||
}
|
||||
|
||||
protected internal virtual string GetDecisionDescription<T>(Parser recognizer, DFA
|
||||
dfa) where T:IToken
|
||||
dfa)
|
||||
where T : IToken
|
||||
{
|
||||
int decision = dfa.decision;
|
||||
int ruleIndex = dfa.atnStartState.ruleIndex;
|
||||
|
|
|
@ -53,18 +53,20 @@ namespace Antlr4.Runtime
|
|||
|
||||
private readonly string predicate;
|
||||
|
||||
public FailedPredicateException(Parser recognizer) : this(recognizer, null)
|
||||
public FailedPredicateException(Parser recognizer)
|
||||
: this(recognizer, null)
|
||||
{
|
||||
}
|
||||
|
||||
public FailedPredicateException(Parser recognizer, string predicate) : this(recognizer
|
||||
, predicate, null)
|
||||
public FailedPredicateException(Parser recognizer, string predicate)
|
||||
: this(recognizer, predicate, null)
|
||||
{
|
||||
}
|
||||
|
||||
public FailedPredicateException(Parser recognizer, string predicate, string message
|
||||
) : base(FormatMessage(predicate, message), recognizer, ((ITokenStream)recognizer
|
||||
.InputStream), recognizer._ctx)
|
||||
)
|
||||
: base(FormatMessage(predicate, message), recognizer, ((ITokenStream)recognizer.InputStream
|
||||
), recognizer._ctx)
|
||||
{
|
||||
ATNState s = recognizer.Interpreter.atn.states[recognizer.State];
|
||||
AbstractPredicateTransition trans = (AbstractPredicateTransition)s.Transition(0);
|
||||
|
|
|
@ -76,6 +76,7 @@ namespace Antlr4.Runtime
|
|||
/// surrounding rule.
|
||||
/// </param>
|
||||
void SyntaxError<T>(Recognizer<T, object> recognizer, T offendingSymbol, int line
|
||||
, int charPositionInLine, string msg, RecognitionException e) where T:Symbol;
|
||||
, int charPositionInLine, string msg, RecognitionException e)
|
||||
where T : Symbol;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,8 @@ namespace Antlr4.Runtime
|
|||
/// </remarks>
|
||||
[NotNull]
|
||||
IToken Create<_T0>(Tuple<_T0> source, int type, string text, int channel, int start
|
||||
, int stop, int line, int charPositionInLine) where _T0:ITokenSource;
|
||||
, int stop, int line, int charPositionInLine)
|
||||
where _T0 : ITokenSource;
|
||||
|
||||
/// <summary>Generically useful</summary>
|
||||
[NotNull]
|
||||
|
|
|
@ -45,8 +45,8 @@ namespace Antlr4.Runtime
|
|||
{
|
||||
private const long serialVersionUID = 1532568338707443067L;
|
||||
|
||||
public InputMismatchException(Parser recognizer) : base(recognizer, ((ITokenStream
|
||||
)recognizer.InputStream), recognizer._ctx)
|
||||
public InputMismatchException(Parser recognizer)
|
||||
: base(recognizer, ((ITokenStream)recognizer.InputStream), recognizer._ctx)
|
||||
{
|
||||
this.OffendingToken = recognizer.CurrentToken;
|
||||
}
|
||||
|
|
|
@ -49,7 +49,8 @@ namespace Antlr4.Runtime
|
|||
private readonly ATNConfigSet deadEndConfigs;
|
||||
|
||||
public LexerNoViableAltException(Lexer lexer, ICharStream input, int startIndex,
|
||||
ATNConfigSet deadEndConfigs) : base(lexer, input)
|
||||
ATNConfigSet deadEndConfigs)
|
||||
: base(lexer, input)
|
||||
{
|
||||
this.startIndex = startIndex;
|
||||
this.deadEndConfigs = deadEndConfigs;
|
||||
|
|
|
@ -61,12 +61,13 @@ namespace Antlr4.Runtime.Misc
|
|||
|
||||
protected internal int initialBucketCapacity = InitalBucketCapacity;
|
||||
|
||||
public Array2DHashSet() : this(null, InitalCapacity, InitalBucketCapacity)
|
||||
public Array2DHashSet()
|
||||
: this(null, InitalCapacity, InitalBucketCapacity)
|
||||
{
|
||||
}
|
||||
|
||||
public Array2DHashSet(EqualityComparer<T> comparator) : this(comparator, InitalCapacity
|
||||
, InitalBucketCapacity)
|
||||
public Array2DHashSet(EqualityComparer<T> comparator)
|
||||
: this(comparator, InitalCapacity, InitalBucketCapacity)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -436,7 +437,8 @@ namespace Antlr4.Runtime.Misc
|
|||
return true;
|
||||
}
|
||||
|
||||
public virtual bool AddAll<_T0>(ICollection<_T0> c) where _T0:T
|
||||
public virtual bool AddAll<_T0>(ICollection<_T0> c)
|
||||
where _T0 : T
|
||||
{
|
||||
bool changed = false;
|
||||
foreach (T o in c)
|
||||
|
|
|
@ -72,7 +72,8 @@ namespace Antlr4.Runtime.Misc
|
|||
this.intervals = intervals;
|
||||
}
|
||||
|
||||
public IntervalSet(Antlr4.Runtime.Misc.IntervalSet set) : this()
|
||||
public IntervalSet(Antlr4.Runtime.Misc.IntervalSet set)
|
||||
: this()
|
||||
{
|
||||
AddAll(set);
|
||||
}
|
||||
|
|
|
@ -54,7 +54,8 @@ namespace Antlr4.Runtime.Misc
|
|||
{
|
||||
}
|
||||
|
||||
public ParseCanceledException(string message) : base(message)
|
||||
public ParseCanceledException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -63,7 +64,8 @@ namespace Antlr4.Runtime.Misc
|
|||
Sharpen.Extensions.InitCause(this, cause);
|
||||
}
|
||||
|
||||
public ParseCanceledException(string message, Exception cause) : base(message)
|
||||
public ParseCanceledException(string message, Exception cause)
|
||||
: base(message)
|
||||
{
|
||||
Sharpen.Extensions.InitCause(this, cause);
|
||||
}
|
||||
|
|
|
@ -129,8 +129,8 @@ namespace Antlr4.Runtime.Misc
|
|||
}
|
||||
|
||||
private static void CheckDependencies<_T0>(IList<Tuple<RuleDependency, IAnnotatedElement
|
||||
>> dependencies, Type<_T0> recognizerType) where _T0:Recognizer<object, object
|
||||
>
|
||||
>> dependencies, Type<_T0> recognizerType)
|
||||
where _T0 : Recognizer<object, object>
|
||||
{
|
||||
string[] ruleNames = GetRuleNames(recognizerType);
|
||||
int[] ruleVersions = GetRuleVersions(recognizerType, ruleNames);
|
||||
|
@ -286,7 +286,8 @@ namespace Antlr4.Runtime.Misc
|
|||
}
|
||||
|
||||
private static int[] GetRuleVersions<_T0>(Type<_T0> recognizerClass, string[] ruleNames
|
||||
) where _T0:Recognizer<object, object>
|
||||
)
|
||||
where _T0 : Recognizer<object, object>
|
||||
{
|
||||
int[] versions = new int[ruleNames.Length];
|
||||
FieldInfo[] fields = recognizerClass.GetFields();
|
||||
|
@ -337,7 +338,8 @@ namespace Antlr4.Runtime.Misc
|
|||
}
|
||||
|
||||
private static MethodInfo GetRuleMethod<_T0>(Type<_T0> recognizerClass, string name
|
||||
) where _T0:Recognizer<object, object>
|
||||
)
|
||||
where _T0 : Recognizer<object, object>
|
||||
{
|
||||
MethodInfo[] declaredMethods = recognizerClass.GetMethods();
|
||||
foreach (MethodInfo method in declaredMethods)
|
||||
|
@ -350,8 +352,8 @@ namespace Antlr4.Runtime.Misc
|
|||
return null;
|
||||
}
|
||||
|
||||
private static string[] GetRuleNames<_T0>(Type<_T0> recognizerClass) where _T0:Recognizer
|
||||
<object, object>
|
||||
private static string[] GetRuleNames<_T0>(Type<_T0> recognizerClass)
|
||||
where _T0 : Recognizer<object, object>
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -480,7 +482,8 @@ namespace Antlr4.Runtime.Misc
|
|||
}
|
||||
|
||||
private static RuleDependencyChecker.RuleRelations ExtractRuleRelations<_T0>(Type
|
||||
<_T0> recognizer) where _T0:Recognizer<object, object>
|
||||
<_T0> recognizer)
|
||||
where _T0 : Recognizer<object, object>
|
||||
{
|
||||
string serializedATN = GetSerializedATN(recognizer);
|
||||
if (serializedATN == null)
|
||||
|
|
|
@ -265,7 +265,8 @@ namespace Antlr4.Runtime.Misc
|
|||
/// <exception cref="System.Reflection.TargetInvocationException"></exception>
|
||||
/// <exception cref="Javax.Print.PrintException"></exception>
|
||||
protected internal virtual void Process<_T0>(Lexer lexer, Type<_T0> parserClass,
|
||||
Parser parser, Stream @is, StreamReader r) where _T0:Parser
|
||||
Parser parser, Stream @is, StreamReader r)
|
||||
where _T0 : Parser
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -67,15 +67,16 @@ namespace Antlr4.Runtime
|
|||
[NotNull]
|
||||
private readonly IToken startToken;
|
||||
|
||||
public NoViableAltException(Parser recognizer) : this(recognizer, ((ITokenStream)
|
||||
recognizer.InputStream), recognizer.CurrentToken, recognizer.CurrentToken, null
|
||||
, recognizer._ctx)
|
||||
public NoViableAltException(Parser recognizer)
|
||||
: this(recognizer, ((ITokenStream)recognizer.InputStream), recognizer.CurrentToken
|
||||
, recognizer.CurrentToken, null, recognizer._ctx)
|
||||
{
|
||||
}
|
||||
|
||||
public NoViableAltException(Recognizer<IToken, object> recognizer, ITokenStream input
|
||||
, IToken startToken, IToken offendingToken, ATNConfigSet deadEndConfigs, ParserRuleContext
|
||||
ctx) : base(recognizer, input, ctx)
|
||||
ctx)
|
||||
: base(recognizer, input, ctx)
|
||||
{
|
||||
// LL(1) error
|
||||
this.deadEndConfigs = deadEndConfigs;
|
||||
|
|
|
@ -153,7 +153,8 @@ namespace Antlr4.Runtime
|
|||
}
|
||||
|
||||
public ParserRuleContext(Antlr4.Runtime.ParserRuleContext parent, int invokingStateNumber
|
||||
) : base(parent, invokingStateNumber)
|
||||
)
|
||||
: base(parent, invokingStateNumber)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -235,8 +236,9 @@ namespace Antlr4.Runtime
|
|||
return children != null && i >= 0 && i < children.Count ? children[i] : null;
|
||||
}
|
||||
|
||||
public virtual T GetChild<T, _T1>(Type<_T1> ctxType, int i) where T:IParseTree where
|
||||
_T1:T
|
||||
public virtual T GetChild<T, _T1>(Type<_T1> ctxType, int i)
|
||||
where T : IParseTree
|
||||
where _T1 : T
|
||||
{
|
||||
if (children == null || i < 0 || i >= children.Count)
|
||||
{
|
||||
|
@ -315,14 +317,16 @@ namespace Antlr4.Runtime
|
|||
return tokens;
|
||||
}
|
||||
|
||||
public virtual T GetRuleContext<T, _T1>(Type<_T1> ctxType, int i) where T:Antlr4.Runtime.ParserRuleContext
|
||||
where _T1:T
|
||||
public virtual T GetRuleContext<T, _T1>(Type<_T1> ctxType, int i)
|
||||
where T : Antlr4.Runtime.ParserRuleContext
|
||||
where _T1 : T
|
||||
{
|
||||
return GetChild(ctxType, i);
|
||||
}
|
||||
|
||||
public virtual IList<T> GetRuleContexts<T, _T1>(Type<_T1> ctxType) where T:Antlr4.Runtime.ParserRuleContext
|
||||
where _T1:T
|
||||
public virtual IList<T> GetRuleContexts<T, _T1>(Type<_T1> ctxType)
|
||||
where T : Antlr4.Runtime.ParserRuleContext
|
||||
where _T1 : T
|
||||
{
|
||||
if (children == null)
|
||||
{
|
||||
|
|
|
@ -64,8 +64,8 @@ namespace Antlr4.Runtime
|
|||
}
|
||||
|
||||
public virtual void SyntaxError<T>(Recognizer<T, object> recognizer, T offendingSymbol
|
||||
, int line, int charPositionInLine, string msg, RecognitionException e) where
|
||||
T:Symbol
|
||||
, int line, int charPositionInLine, string msg, RecognitionException e)
|
||||
where T : Symbol
|
||||
{
|
||||
foreach (IAntlrErrorListener<Symbol> listener in delegates)
|
||||
{
|
||||
|
|
|
@ -39,7 +39,8 @@ namespace Antlr4.Runtime
|
|||
public class ProxyParserErrorListener : ProxyErrorListener<IToken>, IParserErrorListener
|
||||
{
|
||||
public ProxyParserErrorListener(ICollection<IAntlrErrorListener<IToken>> delegates
|
||||
) : base(delegates)
|
||||
)
|
||||
: base(delegates)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,8 @@ namespace Antlr4.Runtime
|
|||
}
|
||||
|
||||
public RecognitionException(string message, Antlr4.Runtime.Recognizer<IToken, object
|
||||
> recognizer, IIntStream input, ParserRuleContext ctx) : base(message)
|
||||
> recognizer, IIntStream input, ParserRuleContext ctx)
|
||||
: base(message)
|
||||
{
|
||||
this.recognizer = recognizer;
|
||||
this.input = input;
|
||||
|
|
|
@ -35,7 +35,8 @@ using Sharpen;
|
|||
|
||||
namespace Antlr4.Runtime
|
||||
{
|
||||
public abstract class Recognizer<Symbol, ATNInterpreter> where ATNInterpreter:ATNSimulator
|
||||
public abstract class Recognizer<Symbol, ATNInterpreter>
|
||||
where ATNInterpreter : ATNSimulator
|
||||
{
|
||||
public const int Eof = -1;
|
||||
|
||||
|
|
|
@ -188,7 +188,8 @@ namespace Antlr4.Runtime
|
|||
}
|
||||
}
|
||||
|
||||
public virtual T Accept<T, _T1>(IParseTreeVisitor<_T1> visitor) where _T1:T
|
||||
public virtual T Accept<T, _T1>(IParseTreeVisitor<_T1> visitor)
|
||||
where _T1 : T
|
||||
{
|
||||
return visitor.VisitChildren(this);
|
||||
}
|
||||
|
|
|
@ -148,8 +148,8 @@ namespace Antlr4.Runtime
|
|||
|
||||
internal class InsertBeforeOp : TokenStreamRewriter.RewriteOperation
|
||||
{
|
||||
public InsertBeforeOp(ITokenStream tokens, int index, object text) : base(tokens,
|
||||
index, text)
|
||||
public InsertBeforeOp(ITokenStream tokens, int index, object text)
|
||||
: base(tokens, index, text)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -176,8 +176,8 @@ namespace Antlr4.Runtime
|
|||
{
|
||||
protected internal int lastIndex;
|
||||
|
||||
public ReplaceOp(ITokenStream tokens, int from, int to, object text) : base(tokens
|
||||
, from, text)
|
||||
public ReplaceOp(ITokenStream tokens, int from, int to, object text)
|
||||
: base(tokens, from, text)
|
||||
{
|
||||
lastIndex = to;
|
||||
}
|
||||
|
@ -722,7 +722,9 @@ namespace Antlr4.Runtime
|
|||
|
||||
/// <summary>Get all operations before an index of a particular kind</summary>
|
||||
protected internal virtual IList<T> GetKindOfOps<T, _T1>(IList<_T1> rewrites, int
|
||||
before) where T:TokenStreamRewriter.RewriteOperation where _T1:TokenStreamRewriter.RewriteOperation
|
||||
before)
|
||||
where T : TokenStreamRewriter.RewriteOperation
|
||||
where _T1 : TokenStreamRewriter.RewriteOperation
|
||||
{
|
||||
System.Type kind = typeof(T);
|
||||
IList<T> ops = new List<T>();
|
||||
|
|
|
@ -46,7 +46,8 @@ namespace Antlr4.Runtime.Tree
|
|||
/// </remarks>
|
||||
public class ErrorNodeImpl : TerminalNodeImpl, IErrorNode
|
||||
{
|
||||
public ErrorNodeImpl(IToken token) : base(token)
|
||||
public ErrorNodeImpl(IToken token)
|
||||
: base(token)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,8 @@ namespace Antlr4.Runtime.Tree
|
|||
/// <see cref="IParseTreeVisitor{Result}">IParseTreeVisitor<Result></see>
|
||||
/// needs a double dispatch method.
|
||||
/// </summary>
|
||||
T Accept<T, _T1>(IParseTreeVisitor<_T1> visitor) where _T1:T;
|
||||
T Accept<T, _T1>(IParseTreeVisitor<_T1> visitor)
|
||||
where _T1 : T;
|
||||
|
||||
/// <summary>Return the combined text of all leaf nodes.</summary>
|
||||
/// <remarks>
|
||||
|
|
|
@ -95,7 +95,8 @@ namespace Antlr4.Runtime.Tree
|
|||
}
|
||||
}
|
||||
|
||||
public virtual T Accept<T, _T1>(IParseTreeVisitor<_T1> visitor) where _T1:T
|
||||
public virtual T Accept<T, _T1>(IParseTreeVisitor<_T1> visitor)
|
||||
where _T1 : T
|
||||
{
|
||||
return visitor.VisitTerminal(this);
|
||||
}
|
||||
|
|
|
@ -136,7 +136,8 @@ namespace Antlr4.Runtime
|
|||
|
||||
/// <summary>Useful for subclasses that pull char from other than this.input.</summary>
|
||||
/// <remarks>Useful for subclasses that pull char from other than this.input.</remarks>
|
||||
public UnbufferedCharStream() : this(256)
|
||||
public UnbufferedCharStream()
|
||||
: this(256)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -148,22 +149,25 @@ namespace Antlr4.Runtime
|
|||
data = new char[bufferSize];
|
||||
}
|
||||
|
||||
public UnbufferedCharStream(Stream input) : this(input, 256)
|
||||
public UnbufferedCharStream(Stream input)
|
||||
: this(input, 256)
|
||||
{
|
||||
}
|
||||
|
||||
public UnbufferedCharStream(StreamReader input) : this(input, 256)
|
||||
public UnbufferedCharStream(StreamReader input)
|
||||
: this(input, 256)
|
||||
{
|
||||
}
|
||||
|
||||
public UnbufferedCharStream(Stream input, int bufferSize) : this(bufferSize)
|
||||
public UnbufferedCharStream(Stream input, int bufferSize)
|
||||
: this(bufferSize)
|
||||
{
|
||||
this.input = new StreamReader(input);
|
||||
Fill(1);
|
||||
}
|
||||
|
||||
public UnbufferedCharStream(StreamReader input, int bufferSize) : this(bufferSize
|
||||
)
|
||||
public UnbufferedCharStream(StreamReader input, int bufferSize)
|
||||
: this(bufferSize)
|
||||
{
|
||||
// prime
|
||||
this.input = input;
|
||||
|
|
|
@ -128,7 +128,8 @@ namespace Antlr4.Runtime
|
|||
/// </remarks>
|
||||
protected internal int currentTokenIndex = 0;
|
||||
|
||||
public UnbufferedTokenStream(ITokenSource tokenSource) : this(tokenSource, 256)
|
||||
public UnbufferedTokenStream(ITokenSource tokenSource)
|
||||
: this(tokenSource, 256)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue