Source: BNF/Token.js

"use strict";

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

/** Creates a new token for BNF.
  * @class Represents a (unique!) token for BNF.
  * @extends page.BNF.T
  * @private
  *
  * @param {string} _name token name.
  * @param {string} _pattern for a token.
  *
  * @property {string} name token name. 
  * @property {string} pattern pattern for token; `null` if name is `$error`.
  */
page.BNF.Token = function (_name, _pattern) {
  page.BNF.T.call(this);

  this.name = _name;
  this.pattern = _pattern;
};

page.subclass(page.BNF.Token, 'page.BNF.Token', page.BNF.T);

/** Displays name of a token.
  * @override
  * @variation Token
  * @returns {string}
  */
page.BNF.Token.prototype.toString = function () {
  return this.name;
};