private void GenerateModelClasses() { foreach (var c in _model.Classes) { if (_model.Public) { _w.Write("public "); } _w.WriteLine("class {0}", c.Name); _w.WriteLine("{").Push(); _w.WriteLine("public StringTreeNode _rawTreeNode;"); foreach (var f in c.Fields) { var typeName = f.Name.Trim('@'); if (f.IsCollection) { typeName += "[]"; } _w.WriteLine("public {0} {1}{2};", typeName, f.Name, f.IsCollection ? "s" : string.Empty); } _w.Pop().WriteLine("}"); _w.WriteLine(); } }
public ParserState <TResult> ExitNode(bool?lastTerminalFailed = null) { if (!this.LastTerminalFailed.HasValue && !lastTerminalFailed.HasValue) { throw new InvalidOperationException(); } var terminalFailed = lastTerminalFailed.HasValue ? lastTerminalFailed : this.LastTerminalFailed; var recursionCallNode = this.RecursionNode; var isExitFromRecursiveCall = recursionCallNode != null && recursionCallNode.Target == this.CurrNode; var nextNode = isExitFromRecursiveCall ? recursionCallNode : this.CurrNode.Parent; if (_log != null) { if (isExitFromRecursiveCall) { _log.WriteLine("Exit from recursion"); } _log.Pop().WriteLine("ExitNode @{3} {0} {1} --> {2}", terminalFailed.HasValue ? ("(" + terminalFailed + ")") : string.Empty, this.CurrNode, nextNode, this.Reader.Location ).Pop(); } return(this.ExitNodeImpl(terminalFailed, nextNode)); }
void IParserStepVisitor.VisitExitNode(IExitStep exitNode) { _w.Pop(); }