Пример #1
0
 /* public void clearData()
  * {
  *
  * }*/
 public static MyHashTable GetInstance()
 {
     if (instance == null)
     {
         instance = new MyHashTable();
     }
     return(instance);
 }
Пример #2
0
        public static double Evaluate(string expression, ref MyHashTable myTable)
        {
            var lexer = new CalculatorGrammarLexer(new AntlrInputStream(expression));

            lexer.RemoveErrorListeners();
            lexer.AddErrorListener(new ThrowExceptionErrorListener());

            var tokens = new CommonTokenStream(lexer);
            var parser = new CalculatorGrammarParser(tokens);

            var tree = parser.compileUnit();

            var visitor = new CalculatorVisitor(ref myTable);

            return(visitor.Visit(tree));
        }
Пример #3
0
 public CalculatorVisitor(ref MyHashTable myTable)
 {
     this.myTable = myTable;
 }
Пример #4
0
 public Form1()
 {
     InitializeComponent();
     InitializeDataGridView(row, colom);
     myTable = MyHashTable.GetInstance();
 }