forked from jasder/antlr
Fix #1298 for CSharp
This commit is contained in:
parent
0901851719
commit
895681044e
|
@ -132,4 +132,5 @@ YYYY/MM/DD, github id, Full name, email
|
|||
2017/01/11, robertbrignull, Robert Brignull, robertbrignull@gmail.com
|
||||
2017/01/13, marcelo-rocha, Marcelo Rocha, mcrocha@gmail.com
|
||||
2017/01/23, bhamiltoncx, Ben Hamilton, bhamiltoncx+antlr@gmail.com
|
||||
2017/01/18, mshockwave, Bekket McClane, yihshyng223@gmail.com
|
||||
2017/01/18, mshockwave, Bekket McClane, yihshyng223@gmail.com
|
||||
2017/02/10, lionelplessis, Lionel Plessis, lionelplessis@users.noreply.github.com
|
|
@ -112,7 +112,7 @@ public class ParseTreesDescriptors {
|
|||
|
||||
@Override
|
||||
public boolean ignore(String targetName) {
|
||||
return !targetName.matches("Java|Python2|Python3|Node|Swift");
|
||||
return !targetName.matches("Java|Python2|Python3|Node|Swift|CSharp");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -116,7 +116,18 @@ namespace Antlr4.Runtime
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>COPY a ctx (I'm deliberately not using copy constructor)</summary>
|
||||
/// <summary>
|
||||
/// COPY a ctx (I'm deliberately not using copy constructor) to avoid
|
||||
/// confusion with creating node with parent. Does not copy children.
|
||||
///
|
||||
/// This is used in the generated parser code to flip a generic XContext
|
||||
/// node for rule X to a YContext for alt label Y. In that sense, it is
|
||||
/// not really a generic copy function.
|
||||
///
|
||||
/// If we do an error sync() at start of a rule, we might add error nodes
|
||||
/// to the generic XContext so this function must copy those nodes to
|
||||
/// the YContext as well else they are lost!
|
||||
/// </summary>
|
||||
public virtual void CopyFrom(Antlr4.Runtime.ParserRuleContext ctx)
|
||||
{
|
||||
// from RuleContext
|
||||
|
@ -124,6 +135,22 @@ namespace Antlr4.Runtime
|
|||
this.invokingState = ctx.invokingState;
|
||||
this._start = ctx._start;
|
||||
this._stop = ctx._stop;
|
||||
|
||||
// copy any error nodes to alt label node
|
||||
if (ctx.children != null)
|
||||
{
|
||||
children = new List<IParseTree>();
|
||||
// reset parent pointer for any error nodes
|
||||
foreach (var child in ctx.children)
|
||||
{
|
||||
var errorChildNode = child as ErrorNodeImpl;
|
||||
if (errorChildNode != null)
|
||||
{
|
||||
children.Add(errorChildNode);
|
||||
errorChildNode.Parent = this;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ParserRuleContext(Antlr4.Runtime.ParserRuleContext parent, int invokingStateNumber)
|
||||
|
|
Loading…
Reference in New Issue