forked from jasder/antlr
Indexer instead of Set
This commit is contained in:
parent
1632053432
commit
633cfb6d23
|
@ -124,7 +124,7 @@ namespace Antlr4.Runtime.Dfa
|
||||||
if (index >= 0)
|
if (index >= 0)
|
||||||
{
|
{
|
||||||
// replace existing entry
|
// replace existing entry
|
||||||
values.Set(index, value);
|
values[index] = value;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
System.Diagnostics.Debug.Assert(index < 0 && value != null);
|
System.Diagnostics.Debug.Assert(index < 0 && value != null);
|
||||||
|
|
|
@ -588,7 +588,7 @@ namespace Antlr4.Runtime
|
||||||
{
|
{
|
||||||
// E.g., insert before 2, delete 2..2; update replace
|
// E.g., insert before 2, delete 2..2; update replace
|
||||||
// text to include insert before, kill insert
|
// text to include insert before, kill insert
|
||||||
rewrites.Set(iop.instructionIndex, null);
|
rewrites[iop.instructionIndex] = null;
|
||||||
rop.text = iop.text.ToString() + (rop.text != null ? rop.text.ToString() : string.Empty
|
rop.text = iop.text.ToString() + (rop.text != null ? rop.text.ToString() : string.Empty
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -597,7 +597,7 @@ namespace Antlr4.Runtime
|
||||||
if (iop.index > rop.index && iop.index <= rop.lastIndex)
|
if (iop.index > rop.index && iop.index <= rop.lastIndex)
|
||||||
{
|
{
|
||||||
// delete insert as it's a no-op.
|
// delete insert as it's a no-op.
|
||||||
rewrites.Set(iop.instructionIndex, null);
|
rewrites[iop.instructionIndex] = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -609,7 +609,7 @@ namespace Antlr4.Runtime
|
||||||
if (prevRop.index >= rop.index && prevRop.lastIndex <= rop.lastIndex)
|
if (prevRop.index >= rop.index && prevRop.lastIndex <= rop.lastIndex)
|
||||||
{
|
{
|
||||||
// delete replace as it's a no-op.
|
// delete replace as it's a no-op.
|
||||||
rewrites.Set(prevRop.instructionIndex, null);
|
rewrites[prevRop.instructionIndex] = null;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// throw exception unless disjoint or identical
|
// throw exception unless disjoint or identical
|
||||||
|
@ -620,7 +620,7 @@ namespace Antlr4.Runtime
|
||||||
if (prevRop.text == null && rop.text == null && !disjoint)
|
if (prevRop.text == null && rop.text == null && !disjoint)
|
||||||
{
|
{
|
||||||
//System.out.println("overlapping deletes: "+prevRop+", "+rop);
|
//System.out.println("overlapping deletes: "+prevRop+", "+rop);
|
||||||
rewrites.Set(prevRop.instructionIndex, null);
|
rewrites[prevRop.instructionIndex] = null;
|
||||||
// kill first delete
|
// kill first delete
|
||||||
rop.index = Math.Min(prevRop.index, rop.index);
|
rop.index = Math.Min(prevRop.index, rop.index);
|
||||||
rop.lastIndex = Math.Max(prevRop.lastIndex, rop.lastIndex);
|
rop.lastIndex = Math.Max(prevRop.lastIndex, rop.lastIndex);
|
||||||
|
@ -662,7 +662,7 @@ namespace Antlr4.Runtime
|
||||||
// whole token buffer so no lazy eval issue with any templates
|
// whole token buffer so no lazy eval issue with any templates
|
||||||
iop.text = CatOpText(iop.text, prevIop.text);
|
iop.text = CatOpText(iop.text, prevIop.text);
|
||||||
// delete redundant prior insert
|
// delete redundant prior insert
|
||||||
rewrites.Set(prevIop.instructionIndex, null);
|
rewrites[prevIop.instructionIndex] = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// look for replaces where iop.index is in range; error
|
// look for replaces where iop.index is in range; error
|
||||||
|
@ -673,7 +673,7 @@ namespace Antlr4.Runtime
|
||||||
if (iop.index == rop.index)
|
if (iop.index == rop.index)
|
||||||
{
|
{
|
||||||
rop.text = CatOpText(iop.text, rop.text);
|
rop.text = CatOpText(iop.text, rop.text);
|
||||||
rewrites.Set(i_1, null);
|
rewrites[i_1] = null;
|
||||||
// delete current insert
|
// delete current insert
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue