name:
src/Parser/ReductionPair.ts
-rw-r--r--
750
1/**
2 * Represents the length to reduce the stack by, and the replacement symbol that will replace those tokens in the stack.
3 */
4class ReductionPair {
5 private lengthToReduceStackBy : number;
6 private replacementSymbol : number;
7 constructor(replacementSymbol : number, length : number) {
8 this.lengthToReduceStackBy = length;
9 this.replacementSymbol = replacementSymbol;
10 }
11
12 /**
13 * Get the number representing the length to reduce the stack by.
14 * @returns {number}
15 */
16 getLengthToReduceStackBy() : number {
17 return this.lengthToReduceStackBy;
18 }
19
20 /**
21 * Get the replacement token index.
22 * @returns {number}
23 */
24 getReplacementSymbol() : number {
25 return this.replacementSymbol;
26 }
27}
28
29export {
30 ReductionPair
31}