예제 #1
0
 public ParseNode(string label, int n, String text, ParseNode p)
 {
     msLabel = label;
     msText = text;
     mnBegin = n;
     mnCount = -1;
     mpParent = p;
 }
예제 #2
0
 internal SwitchStatement(ParseNode node)
     : base(node)
 {
 }
예제 #3
0
 internal ReturnStatement(ParseNode node)
     : base(node)
 {
 }
예제 #4
0
 internal WhileStatement(ParseNode node)
     : base(node)
 {
 }
예제 #5
0
 internal CodeBlock(ParseNode node)
     : base(node)
 {
 }
예제 #6
0
 internal ForStatement(ParseNode node)
     : base(node)
 {
 }
예제 #7
0
 public void CreateNode(string sLabel)
 {
     Debug.Assert(mCur != null);
     mCur = mCur.Add(sLabel, this);
     Debug.Assert(mCur != null);
 }
예제 #8
0
 public ParseNode Add(string sLabel, ParserState p)
 {
     ParseNode ret = new ParseNode(sLabel, p.GetPos(), msText, this);
     mChildren.Add(ret);
     return ret;
 }
예제 #9
0
 internal DeleteStatement(ParseNode node)
     : base(node)
 {
 }
예제 #10
0
 internal VariableDeclaration(ParseNode node)
     : base(node)
 {
 }
예제 #11
0
 static public bool Parse(Rule r, string s, out string output, out ParseNode node)
 {
     return Parse(r, s, 0, out output, out node);
 }
예제 #12
0
 static public bool Parse(Rule r, string s, out ParseNode node)
 {
     ParserState state = new ParserState(s);
     node = state.Parse(r);
     return node != null;
 }
예제 #13
0
 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;
 }
예제 #14
0
 public void CompleteNode()
 {
     Debug.Assert(mCur != null);
     mCur.Complete(this);
     mCur = mCur.GetParent();
     Debug.Assert(mCur != null);
 }
예제 #15
0
 public void AbandonNode()
 {
     Debug.Assert(mCur != null);
     ParseNode tmp = mCur;
     mCur = mCur.GetParent();
     Debug.Assert(mCur != null);
     mCur.Remove(tmp);
 }
예제 #16
0
 internal CaseStatement(ParseNode node)
     : base(node)
 {
 }
예제 #17
0
 internal ExpressionStatement(ParseNode node)
     : base(node)
 {
 }
예제 #18
0
 internal Statement(ParseNode node)
 {
     this.node = node;
 }
예제 #19
0
 public void Remove(ParseNode x)
 {
     mChildren.Remove(x);
 }
예제 #20
0
 public ParserState(string s, int from)
 {
     mInput = s;
     mIndex = from;
     mTree = new ParseNode("ast", mIndex, mInput, null);
     mCur = mTree;
 }