1 /**
  2  * @fileoverview A class representing the string literals.
  3  */
  4 
  5 goog.provide('xrx.xpath.Literal');
  6 
  7 goog.require('xrx.xpath.Expr');
  8 
  9 
 10 
 11 /**
 12  * Constructs a string literal expression.
 13  *
 14  * @param {string} text The text value of the literal.
 15  * @constructor
 16  * @extends {xrx.xpath.Expr}
 17  */
 18 xrx.xpath.Literal = function(text) {
 19   xrx.xpath.Expr.call(this, xrx.xpath.DataType.STRING);
 20 
 21   /**
 22    * @type {string}
 23    * @private
 24    */
 25   this.text_ = text.substring(1, text.length - 1);
 26 };
 27 goog.inherits(xrx.xpath.Literal, xrx.xpath.Expr);
 28 
 29 
 30 /**
 31  * @override
 32  * @return {string} The string result.
 33  */
 34 xrx.xpath.Literal.prototype.evaluate = function(context) {
 35   return this.text_;
 36 };
 37 
 38 
 39 /**
 40  * @override
 41  */
 42 xrx.xpath.Literal.prototype.toString = function() {
 43   return 'Literal: ' + this.text_;
 44 };
 45