-
Notifications
You must be signed in to change notification settings - Fork 2
/
Grammar.php
95 lines (82 loc) · 2.18 KB
/
Grammar.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
/**
* Mohiva Pyramid
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.textile.
* It is also available through the world-wide-web at this URL:
* https://github.com/mohiva/pyramid/blob/master/LICENSE.textile
*
* @category Mohiva/Pyramid
* @package Mohiva/Pyramid
* @author Christian Kaps <christian.kaps@mohiva.com>
* @copyright Copyright (c) 2007-2012 Christian Kaps (http://www.mohiva.com)
* @license https://github.com/mohiva/pyramid/blob/master/LICENSE.textile New BSD License
* @link https://github.com/mohiva/pyramid
*/
namespace com\mohiva\pyramid;
/**
* Represents the grammar for the parser.
*
* @category Mohiva/Pyramid
* @package Mohiva/Pyramid
* @author Christian Kaps <christian.kaps@mohiva.com>
* @copyright Copyright (c) 2007-2012 Christian Kaps (http://www.mohiva.com)
* @license https://github.com/mohiva/pyramid/blob/master/LICENSE.textile New BSD License
* @link https://github.com/mohiva/pyramid
*/
class Grammar {
/**
* The operator table.
*
* @var OperatorTable
*/
private $operatorTable = null;
/**
* The operand table.
*
* @var OperandTable
*/
private $operandTable = null;
/**
* The class constructor.
*/
public function __construct() {
$this->operatorTable = new OperatorTable();
$this->operandTable = new OperandTable();
}
/**
* Adds a new operator to the operator table.
*
* @param Operator $operator The operator to add.
*/
public function addOperator(Operator $operator) {
$this->operatorTable->addOperator($operator);
}
/**
* Adds a new operand to the operand table.
*
* @param Operand $operand The operand to add.
*/
public function addOperand(Operand $operand) {
$this->operandTable->addOperand($operand);
}
/**
* Returns the instance of the operator table.
*
* @return OperatorTable The instance of the operator table.
*/
public function getOperatorTable() {
return $this->operatorTable;
}
/**
* Returns the instance of the operand table.
*
* @return OperandTable The instance of the operand table.
*/
public function getOperandTable() {
return $this->operandTable;
}
}