Fix build errors

This commit is contained in:
Sam Harwell 2013-08-04 22:01:15 -05:00
parent 8111fa5872
commit a4e5bfbae9
21 changed files with 77 additions and 54 deletions

View File

@ -988,41 +988,41 @@
private class SummarizingDiagnosticErrorListener : DiagnosticErrorListener
{
public override void ReportAmbiguity(Parser recognizer, DFA dfa, int startIndex, int stopIndex, BitSet ambigAlts, ATNConfigSet configs)
public override void ReportAmbiguity(Parser recognizer, DFA dfa, int startIndex, int stopIndex, bool exact, BitSet ambigAlts, ATNConfigSet configs)
{
if (!REPORT_AMBIGUITIES)
{
return;
}
base.ReportAmbiguity(recognizer, dfa, startIndex, stopIndex, ambigAlts, configs);
base.ReportAmbiguity(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs);
}
public override void ReportAttemptingFullContext(Parser recognizer, DFA dfa, int startIndex, int stopIndex, SimulatorState initialState)
public override void ReportAttemptingFullContext(Parser recognizer, DFA dfa, int startIndex, int stopIndex, BitSet conflictingAlts, SimulatorState initialState)
{
if (!REPORT_FULL_CONTEXT)
{
return;
}
base.ReportAttemptingFullContext(recognizer, dfa, startIndex, stopIndex, initialState);
base.ReportAttemptingFullContext(recognizer, dfa, startIndex, stopIndex, conflictingAlts, initialState);
}
public override void ReportContextSensitivity(Parser recognizer, DFA dfa, int startIndex, int stopIndex, SimulatorState acceptState)
public override void ReportContextSensitivity(Parser recognizer, DFA dfa, int startIndex, int stopIndex, int prediction, SimulatorState acceptState)
{
if (!REPORT_CONTEXT_SENSITIVITY)
{
return;
}
base.ReportContextSensitivity(recognizer, dfa, startIndex, stopIndex, acceptState);
base.ReportContextSensitivity(recognizer, dfa, startIndex, stopIndex, prediction, acceptState);
}
protected override string GetDecisionDescription(Parser recognizer, int decision)
protected override string GetDecisionDescription(Parser recognizer, DFA dfa)
{
string format = "{0}({1})";
string ruleName = recognizer.RuleNames[recognizer.Atn.decisionToState[decision].ruleIndex];
return string.Format(format, decision, ruleName);
string ruleName = recognizer.RuleNames[recognizer.Atn.decisionToState[dfa.decision].ruleIndex];
return string.Format(format, dfa.decision, ruleName);
}
}

View File

@ -75,6 +75,7 @@
<Compile Include="Atn\ATNConfigSet.cs" />
<Compile Include="Atn\ATNSimulator.cs" />
<Compile Include="Atn\ATNState.cs" />
<Compile Include="Atn\ATNType.cs" />
<Compile Include="Atn\AtomTransition.cs" />
<Compile Include="Atn\BasicBlockStartState.cs" />
<Compile Include="Atn\BasicState.cs" />
@ -88,7 +89,6 @@
<Compile Include="Atn\LoopEndState.cs" />
<Compile Include="Atn\NotSetTransition.cs" />
<Compile Include="Atn\OrderedATNConfigSet.cs" />
<Compile Include="Atn\ParserATNPathFinder.cs" />
<Compile Include="Atn\ParserATNSimulator.cs" />
<Compile Include="Atn\PlusBlockStartState.cs" />
<Compile Include="Atn\PlusLoopbackState.cs" />
@ -152,6 +152,7 @@
<Link>Key.snk</Link>
</None>
<None Include="Misc\Array2DHashSet`1.cs" />
<Compile Include="Misc\MurmurHash.cs" />
<Compile Include="Misc\NullableAttribute.cs" />
<None Include="Misc\DoubleKeyMap`3.cs" />
<Compile Include="Misc\IIntSet.cs" />

View File

@ -59,6 +59,7 @@
<Compile Include="Atn\ATNConfigSet.cs" />
<Compile Include="Atn\ATNSimulator.cs" />
<Compile Include="Atn\ATNState.cs" />
<Compile Include="Atn\ATNType.cs" />
<Compile Include="Atn\AtomTransition.cs" />
<Compile Include="Atn\BasicBlockStartState.cs" />
<Compile Include="Atn\BasicState.cs" />
@ -72,7 +73,6 @@
<Compile Include="Atn\LoopEndState.cs" />
<Compile Include="Atn\NotSetTransition.cs" />
<Compile Include="Atn\OrderedATNConfigSet.cs" />
<Compile Include="Atn\ParserATNPathFinder.cs" />
<Compile Include="Atn\ParserATNSimulator.cs" />
<Compile Include="Atn\PlusBlockStartState.cs" />
<Compile Include="Atn\PlusLoopbackState.cs" />
@ -136,6 +136,7 @@
<Link>Key.snk</Link>
</None>
<None Include="Misc\Array2DHashSet`1.cs" />
<Compile Include="Misc\MurmurHash.cs" />
<Compile Include="Misc\NullableAttribute.cs" />
<None Include="Misc\DoubleKeyMap`3.cs" />
<Compile Include="Misc\IIntSet.cs" />

View File

@ -58,6 +58,7 @@
<Compile Include="Atn\ATNConfigSet.cs" />
<Compile Include="Atn\ATNSimulator.cs" />
<Compile Include="Atn\ATNState.cs" />
<Compile Include="Atn\ATNType.cs" />
<Compile Include="Atn\AtomTransition.cs" />
<Compile Include="Atn\BasicBlockStartState.cs" />
<Compile Include="Atn\BasicState.cs" />
@ -71,7 +72,6 @@
<Compile Include="Atn\LoopEndState.cs" />
<Compile Include="Atn\NotSetTransition.cs" />
<Compile Include="Atn\OrderedATNConfigSet.cs" />
<Compile Include="Atn\ParserATNPathFinder.cs" />
<Compile Include="Atn\ParserATNSimulator.cs" />
<Compile Include="Atn\PlusBlockStartState.cs" />
<Compile Include="Atn\PlusLoopbackState.cs" />
@ -135,6 +135,7 @@
<Link>Key.snk</Link>
</None>
<None Include="Misc\Array2DHashSet`1.cs" />
<Compile Include="Misc\MurmurHash.cs" />
<Compile Include="Misc\NullableAttribute.cs" />
<None Include="Misc\DoubleKeyMap`3.cs" />
<Compile Include="Misc\IIntSet.cs" />

View File

@ -58,6 +58,7 @@
<Compile Include="Atn\ATNConfigSet.cs" />
<Compile Include="Atn\ATNSimulator.cs" />
<Compile Include="Atn\ATNState.cs" />
<Compile Include="Atn\ATNType.cs" />
<Compile Include="Atn\AtomTransition.cs" />
<Compile Include="Atn\BasicBlockStartState.cs" />
<Compile Include="Atn\BasicState.cs" />
@ -71,7 +72,6 @@
<Compile Include="Atn\LoopEndState.cs" />
<Compile Include="Atn\NotSetTransition.cs" />
<Compile Include="Atn\OrderedATNConfigSet.cs" />
<Compile Include="Atn\ParserATNPathFinder.cs" />
<Compile Include="Atn\ParserATNSimulator.cs" />
<Compile Include="Atn\PlusBlockStartState.cs" />
<Compile Include="Atn\PlusLoopbackState.cs" />
@ -135,6 +135,7 @@
<Link>Key.snk</Link>
</None>
<None Include="Misc\Array2DHashSet`1.cs" />
<Compile Include="Misc\MurmurHash.cs" />
<Compile Include="Misc\NullableAttribute.cs" />
<None Include="Misc\DoubleKeyMap`3.cs" />
<Compile Include="Misc\IIntSet.cs" />

View File

@ -61,6 +61,7 @@
<Compile Include="Atn\ATNConfigSet.cs" />
<Compile Include="Atn\ATNSimulator.cs" />
<Compile Include="Atn\ATNState.cs" />
<Compile Include="Atn\ATNType.cs" />
<Compile Include="Atn\AtomTransition.cs" />
<Compile Include="Atn\BasicBlockStartState.cs" />
<Compile Include="Atn\BasicState.cs" />
@ -74,7 +75,6 @@
<Compile Include="Atn\LoopEndState.cs" />
<Compile Include="Atn\NotSetTransition.cs" />
<Compile Include="Atn\OrderedATNConfigSet.cs" />
<Compile Include="Atn\ParserATNPathFinder.cs" />
<Compile Include="Atn\ParserATNSimulator.cs" />
<Compile Include="Atn\PlusBlockStartState.cs" />
<Compile Include="Atn\PlusLoopbackState.cs" />
@ -138,6 +138,7 @@
<Link>Key.snk</Link>
</None>
<None Include="Misc\Array2DHashSet`1.cs" />
<Compile Include="Misc\MurmurHash.cs" />
<Compile Include="Misc\NullableAttribute.cs" />
<None Include="Misc\DoubleKeyMap`3.cs" />
<Compile Include="Misc\IIntSet.cs" />

View File

@ -62,6 +62,7 @@
<Compile Include="Atn\ATNConfigSet.cs" />
<Compile Include="Atn\ATNSimulator.cs" />
<Compile Include="Atn\ATNState.cs" />
<Compile Include="Atn\ATNType.cs" />
<Compile Include="Atn\AtomTransition.cs" />
<Compile Include="Atn\BasicBlockStartState.cs" />
<Compile Include="Atn\BasicState.cs" />
@ -75,7 +76,6 @@
<Compile Include="Atn\LoopEndState.cs" />
<Compile Include="Atn\NotSetTransition.cs" />
<Compile Include="Atn\OrderedATNConfigSet.cs" />
<Compile Include="Atn\ParserATNPathFinder.cs" />
<Compile Include="Atn\ParserATNSimulator.cs" />
<Compile Include="Atn\PlusBlockStartState.cs" />
<Compile Include="Atn\PlusLoopbackState.cs" />
@ -139,6 +139,7 @@
<Link>Key.snk</Link>
</None>
<None Include="Misc\Array2DHashSet`1.cs" />
<Compile Include="Misc\MurmurHash.cs" />
<Compile Include="Misc\NullableAttribute.cs" />
<None Include="Misc\DoubleKeyMap`3.cs" />
<Compile Include="Misc\IIntSet.cs" />

View File

@ -144,7 +144,6 @@
<Compile Include="Misc\IIntSet.cs" />
<Compile Include="Misc\Interval.cs" />
<Compile Include="Misc\IntervalSet.cs" />
<Compile Include="Misc\JFileChooserConfirmOverwrite.cs" />
<None Include="Misc\MultiMap`2.cs" />
<Compile Include="Misc\MurmurHash.cs" />
<Compile Include="Misc\NotNullAttribute.cs" />

View File

@ -174,7 +174,7 @@ namespace Antlr4.Runtime.Atn
/// <code>s</code>
/// 's rule.
/// </summary>
[NotNull]
[return: NotNull]
public virtual IntervalSet NextTokens(ATNState s, PredictionContext ctx)
{
Args.NotNull("ctx", ctx);
@ -192,7 +192,7 @@ namespace Antlr4.Runtime.Atn
/// is in set if we reach end of
/// rule.
/// </summary>
[NotNull]
[return: NotNull]
public virtual IntervalSet NextTokens(ATNState s)
{
if (s.nextTokenWithinRule != null)
@ -286,7 +286,7 @@ namespace Antlr4.Runtime.Atn
/// number
/// <code>stateNumber</code>
/// </exception>
[NotNull]
[return: NotNull]
public virtual IntervalSet GetExpectedTokens(int stateNumber, RuleContext context
)
{

View File

@ -42,7 +42,7 @@ namespace Antlr4.Runtime.Atn
{
public static readonly int SerializedVersion = 3;
public static readonly UUID SerializedUuid = UUID.FromString("E4178468-DF95-44D0-AD87-F22A5D5FB6D3");
public static readonly Guid SerializedUuid = new Guid("E4178468-DF95-44D0-AD87-F22A5D5FB6D3");
public const char RuleVariantDelimiter = '$';
@ -89,16 +89,15 @@ namespace Antlr4.Runtime.Atn
, version, SerializedVersion);
throw new NotSupportedException(reason);
}
UUID uuid = ToUUID(data, p);
Guid uuid = ToUUID(data, p);
p += 8;
if (!uuid.Equals(SerializedUuid))
{
string reason = string.Format(CultureInfo.CurrentCulture, "Could not deserialize ATN with UUID %s (expected %s)."
string reason = string.Format(CultureInfo.CurrentCulture, "Could not deserialize ATN with UUID {0} (expected {1})."
, uuid, SerializedUuid);
throw new NotSupportedException(new InvalidClassException(typeof(ATN).FullName, reason
));
throw new NotSupportedException(reason);
}
ATNType grammarType = ATNType.Values()[ToInt(data[p++])];
ATNType grammarType = (ATNType)ToInt(data[p++]);
int maxTokenType = ToInt(data[p++]);
ATN atn = new ATN(grammarType, maxTokenType);
//
@ -863,11 +862,16 @@ nextTransition_continue: ;
return lowOrder | ((long)ToInt32(data, offset + 2) << 32);
}
public static UUID ToUUID(char[] data, int offset)
public static Guid ToUUID(char[] data, int offset)
{
long leastSigBits = ToLong(data, offset);
long mostSigBits = ToLong(data, offset + 4);
return new UUID(mostSigBits, leastSigBits);
byte[] leastSigBits = BitConverter.GetBytes(ToLong(data, offset));
byte[] mostSigBits = BitConverter.GetBytes(ToLong(data, offset + 4));
byte[] bits = leastSigBits;
Array.Resize(ref bits, leastSigBits.Length + mostSigBits.Length);
Buffer.BlockCopy(mostSigBits, 0, bits, leastSigBits.Length, mostSigBits.Length);
return new Guid(bits);
}
[return: NotNull]

View File

@ -210,7 +210,7 @@ namespace Antlr4.Runtime.Atn
if (epsilonOnlyTransitions != e.IsEpsilon)
{
#if !PORTABLE
System.Console.Error.Format(CultureInfo.CurrentCulture, "ATN state {0} has both epsilon and non-epsilon transitions."
System.Console.Error.WriteLine("ATN state {0} has both epsilon and non-epsilon transitions."
, stateNumber);
#endif
epsilonOnlyTransitions = false;

View File

@ -139,7 +139,7 @@ namespace Antlr4.Runtime.Atn
/// <code>ctx</code>
/// .
/// </returns>
[NotNull]
[return: NotNull]
public virtual IntervalSet Look(ATNState s, PredictionContext ctx)
{
return Look(s, null, ctx);

View File

@ -262,15 +262,17 @@ namespace Antlr4.Runtime.Atn
/// if the target state for this edge is not
/// already cached
/// </returns>
[Nullable]
[return: Nullable]
protected internal virtual DFAState GetExistingTargetState(DFAState s, int t)
{
DFAState target = s.GetTarget(t);
#if !PORTABLE
if (debug && target != null)
{
System.Console.Out.WriteLine("reuse state " + s.stateNumber + " edge to " + target
.stateNumber);
}
#endif
return target;
}
@ -295,7 +297,7 @@ namespace Antlr4.Runtime.Atn
/// <see cref="ATNSimulator.Error">ATNSimulator.Error</see>
/// .
/// </returns>
[NotNull]
[return: NotNull]
protected internal virtual DFAState ComputeTargetState(ICharStream input, DFAState
s, int t)
{

View File

@ -850,7 +850,7 @@ namespace Antlr4.Runtime.Atn
/// if the target state for this edge is not
/// already cached
/// </returns>
[Nullable]
[return: Nullable]
protected internal virtual DFAState GetExistingTargetState(DFAState s, int t)
{
return s.GetTarget(t);
@ -880,7 +880,7 @@ namespace Antlr4.Runtime.Atn
/// <see cref="ATNSimulator.Error">ATNSimulator.Error</see>
/// .
/// </returns>
[NotNull]
[return: NotNull]
protected internal virtual Tuple<DFAState, ParserRuleContext> ComputeTargetState(
DFA dfa, DFAState s, ParserRuleContext remainingGlobalContext, int t, bool useContext
, PredictionContextCache contextCache)
@ -1405,7 +1405,7 @@ namespace Antlr4.Runtime.Atn
// track how far we dip into outer context. Might
// come in handy and we avoid evaluating context dependent
// preds if this is > 0.
if (!closureBusy.AddItem(c))
if (!closureBusy.Add(c))
{
// avoid infinite recursion for right-recursive rules
continue;

View File

@ -711,7 +711,7 @@ namespace Antlr4.Runtime
/// deletion successfully recovers from the mismatched input, otherwise
/// <code>null</code>
/// </returns>
[Nullable]
[return: Nullable]
protected internal virtual IToken SingleTokenDeletion(Parser recognizer)
{
int nextTokenType = ((ITokenStream)recognizer.InputStream).La(2);
@ -750,7 +750,7 @@ namespace Antlr4.Runtime
/// If you change what tokens must be created by the lexer,
/// override this method to create the appropriate tokens.
/// </remarks>
[NotNull]
[return: NotNull]
protected internal virtual IToken GetMissingSymbol(Parser recognizer)
{
IToken currentSymbol = recognizer.CurrentToken;
@ -785,7 +785,7 @@ namespace Antlr4.Runtime
Line, current.Column);
}
[NotNull]
[return: NotNull]
protected internal virtual IntervalSet GetExpectedTokens(Parser recognizer)
{
return recognizer.GetExpectedTokens();
@ -836,7 +836,7 @@ namespace Antlr4.Runtime
return symbol.Type;
}
[NotNull]
[return: NotNull]
protected internal virtual string EscapeWSAndQuote(string s)
{
// if ( s==null ) return s;
@ -846,7 +846,7 @@ namespace Antlr4.Runtime
return "'" + s + "'";
}
[NotNull]
[return: NotNull]
protected internal virtual IntervalSet GetErrorRecoverySet(Parser recognizer)
{
ATN atn = recognizer.Interpreter.atn;

View File

@ -135,8 +135,8 @@ namespace Antlr4.Runtime
recognizer.NotifyErrorListeners(message);
}
protected internal virtual string GetDecisionDescription<T>(Parser recognizer, DFA
dfa) where T:IToken
protected internal virtual string GetDecisionDescription(Parser recognizer, DFA
dfa)
{
int decision = dfa.decision;
int ruleIndex = dfa.atnStartState.ruleIndex;
@ -146,7 +146,7 @@ namespace Antlr4.Runtime
return decision.ToString();
}
string ruleName = ruleNames[ruleIndex];
if (ruleName == null || ruleName.IsEmpty())
if (string.IsNullOrEmpty(ruleName))
{
return decision.ToString();
}
@ -178,7 +178,7 @@ namespace Antlr4.Runtime
/// <code>configs</code>
/// .
/// </returns>
[NotNull]
[return: NotNull]
protected internal virtual BitSet GetConflictingAlts(BitSet reportedAlts, ATNConfigSet
configs)
{

View File

@ -88,7 +88,7 @@ namespace Antlr4.Runtime
/// recover from the unexpected input symbol
/// </exception>
/// <exception cref="Antlr4.Runtime.RecognitionException"></exception>
[NotNull]
[return: NotNull]
IToken RecoverInline(Parser recognizer);
/// <summary>

View File

@ -51,12 +51,12 @@ namespace Antlr4.Runtime
/// error handling strategy. If text!=null, than the start and stop positions
/// are wiped to -1 in the text override is set in the CommonToken.
/// </remarks>
[NotNull]
[return: NotNull]
IToken Create(Tuple<ITokenSource, ICharStream> source, int type, string text, int channel, int start
, int stop, int line, int charPositionInLine);
/// <summary>Generically useful</summary>
[NotNull]
[return: NotNull]
IToken Create(int type, string text);
}
}

View File

@ -254,7 +254,7 @@ namespace Antlr4.Runtime
/// mismatched symbol
/// </exception>
/// <exception cref="Antlr4.Runtime.RecognitionException"></exception>
[NotNull]
[return: NotNull]
public virtual IToken Match(int ttype)
{
IToken t = CurrentToken;
@ -310,7 +310,7 @@ namespace Antlr4.Runtime
/// symbol
/// </exception>
/// <exception cref="Antlr4.Runtime.RecognitionException"></exception>
[NotNull]
[return: NotNull]
public virtual IToken MatchWildcard()
{
IToken t = CurrentToken;
@ -440,7 +440,7 @@ namespace Antlr4.Runtime
IList<IParseTreeListener> listeners = _parseListeners;
if (listeners == null)
{
return Sharpen.Collections.EmptyList();
return Sharpen.Collections.EmptyList<IParseTreeListener>();
}
return listeners;
}
@ -982,13 +982,13 @@ namespace Antlr4.Runtime
/// </summary>
/// <seealso cref="Antlr4.Runtime.Atn.ATN.GetExpectedTokens(int, RuleContext)">Antlr4.Runtime.Atn.ATN.GetExpectedTokens(int, RuleContext)
/// </seealso>
[NotNull]
[return: NotNull]
public virtual IntervalSet GetExpectedTokens()
{
return Atn.GetExpectedTokens(State, Context);
}
[NotNull]
[return: NotNull]
public virtual IntervalSet GetExpectedTokensWithinCurrentRule()
{
ATN atn = Interpreter.atn;

View File

@ -156,7 +156,7 @@ namespace Antlr4.Runtime
/// <code>null</code>
/// if the information is not available.
/// </returns>
[Nullable]
[return: Nullable]
public virtual IntervalSet GetExpectedTokens()
{
if (recognizer != null)

View File

@ -140,6 +140,18 @@ namespace Sharpen
return result;
}
public void Clear(int index)
{
if (index < 0)
throw new ArgumentOutOfRangeException("index");
int element = index / BitsPerElement;
if (element >= _data.Length)
return;
_data[element] &= ~(1UL << (index % BitsPerElement));
}
public bool Get(int index)
{
if (index < 0)