public ParseNode(string label, int n, String text, ParseNode p) { msLabel = label; msText = text; mnBegin = n; mnCount = -1; mpParent = p; }
internal SwitchStatement(ParseNode node) : base(node) { }
internal ReturnStatement(ParseNode node) : base(node) { }
internal WhileStatement(ParseNode node) : base(node) { }
internal CodeBlock(ParseNode node) : base(node) { }
internal ForStatement(ParseNode node) : base(node) { }
public void CreateNode(string sLabel) { Debug.Assert(mCur != null); mCur = mCur.Add(sLabel, this); Debug.Assert(mCur != null); }
public ParseNode Add(string sLabel, ParserState p) { ParseNode ret = new ParseNode(sLabel, p.GetPos(), msText, this); mChildren.Add(ret); return ret; }
internal DeleteStatement(ParseNode node) : base(node) { }
internal VariableDeclaration(ParseNode node) : base(node) { }
static public bool Parse(Rule r, string s, out string output, out ParseNode node) { return Parse(r, s, 0, out output, out node); }
static public bool Parse(Rule r, string s, out ParseNode node) { ParserState state = new ParserState(s); node = state.Parse(r); return node != null; }
static public bool Parse(Rule r, string s, int from, out string output, out ParseNode node) { ParserState state = new ParserState(s, from); node = state.Parse(r); int n = state.GetPos() - from; if (node != null && n > 0) output = s.Substring(from, n); else output = ""; return node != null; }
public void CompleteNode() { Debug.Assert(mCur != null); mCur.Complete(this); mCur = mCur.GetParent(); Debug.Assert(mCur != null); }
public void AbandonNode() { Debug.Assert(mCur != null); ParseNode tmp = mCur; mCur = mCur.GetParent(); Debug.Assert(mCur != null); mCur.Remove(tmp); }
internal CaseStatement(ParseNode node) : base(node) { }
internal ExpressionStatement(ParseNode node) : base(node) { }
internal Statement(ParseNode node) { this.node = node; }
public void Remove(ParseNode x) { mChildren.Remove(x); }
public ParserState(string s, int from) { mInput = s; mIndex = from; mTree = new ParseNode("ast", mIndex, mInput, null); mCur = mTree; }