001: /*
002: * xtc - The eXTensible Compiler
003: * Copyright (C) 2004-2007 Robert Grimm
004: *
005: * This program is free software; you can redistribute it and/or
006: * modify it under the terms of the GNU General Public License
007: * version 2 as published by the Free Software Foundation.
008: *
009: * This program is distributed in the hope that it will be useful,
010: * but WITHOUT ANY WARRANTY; without even the implied warranty of
011: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
012: * GNU General Public License for more details.
013: *
014: * You should have received a copy of the GNU General Public License
015: * along with this program; if not, write to the Free Software
016: * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
017: * USA.
018: */
019: package xtc.parser;
020:
021: import xtc.tree.Node;
022:
023: /**
024: * The superclass of all grammar elements.
025: *
026: * @author Robert Grimm
027: * @version $Revision: 1.13 $
028: */
029: public abstract class Element extends Node {
030:
031: /** An element's tag. */
032: public static enum Tag {
033: /** An action. */
034: ACTION,
035: /** A node marker. */
036: NODE_MARKER,
037: /** A nonterminal. */
038: NONTERMINAL,
039: /** A null literal. */
040: NULL,
041: /** An ordered choice. */
042: CHOICE,
043: /** A parse tree node. */
044: PARSE_TREE_NODE,
045: /** A sequence. */
046: SEQUENCE,
047: /** The any character constant. */
048: ANY_CHAR,
049: /** A character class. */
050: CHAR_CLASS,
051: /** A character literal. */
052: CHAR_LITERAL,
053: /** A character switch. */
054: CHAR_SWITCH,
055: /** A string literal. */
056: STRING_LITERAL,
057: /** A binding. */
058: BINDING,
059: /** A parser action. */
060: PARSER_ACTION,
061: /** A followed-by predicate. */
062: FOLLOWED_BY,
063: /** A not-followed-by predicate. */
064: NOT_FOLLOWED_BY,
065: /** A semantic predicate. */
066: SEMANTIC_PREDICATE,
067: /** An option. */
068: OPTION,
069: /** A repetition. */
070: REPETITION,
071: /** A string match. */
072: STRING_MATCH,
073: /** A voided element. */
074: VOIDED,
075: /** An action base value. */
076: ACTION_BASE_VALUE,
077: /** A binding value. */
078: BINDING_VALUE,
079: /** A generic action value. */
080: GENERIC_ACTION_VALUE,
081: /** A generic recursion value. */
082: GENERIC_RECURSION_VALUE,
083: /** A generic node vlaue. */
084: GENERIC_NODE_VALUE,
085: /** An empty list value. */
086: EMPTY_LIST_VALUE,
087: /** A proper list value. */
088: PROPER_LIST_VALUE,
089: /** A null value. */
090: NULL_VALUE,
091: /** A string value. */
092: STRING_VALUE,
093: /** A token value. */
094: TOKEN_VALUE
095: }
096:
097: /** Create a new element. */
098: public Element() { /* Nothing to do. */
099: }
100:
101: /**
102: * Get this element's tag.
103: *
104: * @return The tag.
105: */
106: public abstract Tag tag();
107:
108: }
|