Source: BNF/T.js

"use strict";

/** @fileOverview Implements `class page.BNF.T`.
  * @author Axel T. Schreiner <ats@cs.rit.edu>
  * @version 1.5.0
  */

/** Creates a new terminal for BNF.
  * @class Represents a (unique!) terminal for BNF.
  * @private
  *
  * @property {number} ord global index; transient, set in {@link page.BNF#init}.
  * @property {Map} first maps `ord` to `this`; transient, set in {@link page.BNF#init}.
  */
page.BNF.T = function () {
  this.ord = undefined;
  this.first = undefined;
};

page.baseclass(page.BNF.T, 'page.BNF.T');

/** Displays ordinal number, if any, and description of terminal.
  * @returns {string}
  */
page.BNF.T.prototype.dump = function () {
  return (this.ord >= 0 ? this.ord : '?') + ': ' + this.toString();
};