01: /*
02: * xtc - The eXTensible Compiler
03: * Copyright (C) 2004-2007 Robert Grimm
04: *
05: * This program is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU General Public License
07: * version 2 as published by the Free Software Foundation.
08: *
09: * This program is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: * GNU General Public License for more details.
13: *
14: * You should have received a copy of the GNU General Public License
15: * along with this program; if not, write to the Free Software
16: * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
17: * USA.
18: */
19: package xtc.parser;
20:
21: import java.io.IOException;
22:
23: /**
24: * The any character element.
25: *
26: * @author Robert Grimm
27: * @version $Revision: 1.9 $
28: */
29: public class AnyChar extends CharTerminal {
30:
31: /** The canonical any character element. */
32: public static final AnyChar ANY = new AnyChar();
33:
34: /** Hide the constructor. */
35: private AnyChar() { /* Nothing to do. */
36: }
37:
38: public Tag tag() {
39: return Tag.ANY_CHAR;
40: }
41:
42: public int hashCode() {
43: return 3;
44: }
45:
46: public boolean equals(Object o) {
47: if (ANY == o)
48: return true;
49: return (o instanceof AnyChar);
50: }
51:
52: public void write(Appendable out) throws IOException {
53: out.append('_');
54: }
55:
56: public String toString() {
57: return "_";
58: }
59:
60: }
|