Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
ParserStack.cs
Go to the documentation of this file.
1 #region License
2 /* **********************************************************************************
3  * Copyright (c) Roman Ivantsov
4  * This source code is subject to terms and conditions of the MIT License
5  * for Irony. A copy of the license can be found in the License.txt file
6  * at the root of this distribution.
7  * By using this source code in any fashion, you are agreeing to be bound by the terms of the
8  * MIT License.
9  * You must not remove this notice from this software.
10  * **********************************************************************************/
11 #endregion
12 
13 using System;
14 using System.Collections.Generic;
15 using System.Text;
16 
17 namespace Irony.Parsing {
18 
19  public class ParserStack : List<ParseTreeNode> {
20  public ParserStack() : base(200) { }
21  public void Push(ParseTreeNode nodeInfo) {
22  base.Add(nodeInfo);
23  }
24  public void Push(ParseTreeNode nodeInfo, ParserState state) {
25  nodeInfo.State = state;
26  base.Add(nodeInfo);
27  }
28  public ParseTreeNode Pop() {
29  var top = Top;
30  base.RemoveAt(Count - 1);
31  return top;
32  }
33  public void Pop(int count) {
34  base.RemoveRange(Count - count, count);
35  }
36  public void PopUntil(int finalCount) {
37  if (finalCount < Count)
38  Pop(Count - finalCount);
39  }
40  public ParseTreeNode Top {
41  get {
42  if (Count == 0) return null;
43  return base[Count - 1];
44  }
45  }
46  }
47 }
ParseTreeNode Pop()
Definition: ParserStack.cs:28
void Pop(int count)
Definition: ParserStack.cs:33
_In_ size_t count
Definition: DirectXTexP.h:174
void Push(ParseTreeNode nodeInfo, ParserState state)
Definition: ParserStack.cs:24
void PopUntil(int finalCount)
Definition: ParserStack.cs:36
void Push(ParseTreeNode nodeInfo)
Definition: ParserStack.cs:21