summaryrefslogtreecommitdiff
path: root/sources/scala/xml/Comment.scala
blob: 226a881da89fc506cd9ebba30145193d41226a32 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*                     __                                               *\
**     ________ ___   / /  ___     Scala API                            **
**    / __/ __// _ | / /  / _ |    (c) 2003-2004, LAMP/EPFL             **
**  __\ \/ /__/ __ |/ /__/ __ |                                         **
** /____/\___/_/ |_/____/_/ | |                                         **
**                          |/                                          **
** $Id$
\*                                                                      */

package scala.xml;

import scala.collection.immutable ;

/** an XML node for comments.
 *
 * @author Burak Emir
 * @param text text contained in this node, may not contain "--"
**/

case class Comment( text:String ) extends Node {

  if( text.indexOf("--" ) != -1 )
    throw new IllegalArgumentException("text containts \"--\"");

  /** the constant "#REM" */
  def label    = "#REM";

  /** always empty */
  final def attribute = Node.NoAttributes;

  /** always empty */
  final def child = Nil;

  /** hashcode for this Comment */
  override def hashCode() = text.hashCode();

  /** returns "<!--"+text+"-->" */
  final override def toString() = "<!--"+text+"-->";

}