"use strict";
/** @fileOverview Implements `class page.BNFP.Precedence`.
* @author Axel T. Schreiner <ats@cs.rit.edu>
* @version 1.5.0
*/
/** Creates a new representation for a list of terminals of equal precedence and associativity.
* @class Represents a list of terminals of equal precedence and associativity.
* Precedences are used in the context of SLR(1) disambiguation.
* @private
* @borrows dump as toString
*
* @param {string} _assoc associativity, `'left'`, `'right'`, or `'nonassoc'`.
* @param {page.BNF.T[]} _terminals list of terminals.
*
* @property {string} assoc associativity, `'left'`, `'right'`, or `'nonassoc'`.
* @property {page.BNF.T[]} terminals list of terminals.
*
* @see page.SLR1
*/
page.BNFP.Precedence = function (_assoc, _terminals) {
this.assoc = _assoc;
this.terminals = _terminals;
};
page.baseclass(page.BNFP.Precedence, 'page.BNFP.Precedence');
/** Displays associativity and the list of terminals.
* @returns {string}.
*/
page.BNFP.Precedence.prototype.toString = function () {
return '%' + this.assoc + ' ' + this.terminals.join(' ');
};
/** Displays associativity and the list of terminals.
* @function
* @returns {string}.
*/
page.BNFP.Precedence.prototype.dump = page.BNFP.Precedence.prototype.toString;