2
* Copyright (C) 2001-2012 Michael Fuchs
4
* This file is part of herold.
6
* herold is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
11
* herold is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with herold. If not, see <http://www.gnu.org/licenses/>.
19
package org.dbdoclet.trafo.xml.tokenizer.parser;
21
@SuppressWarnings("all")
22
public class JJTXmlTokenizerState {
23
private java.util.List<Node> nodes;
24
private java.util.List<Integer> marks;
26
private int sp; // number of nodes on stack
27
private int mk; // current mark
28
private boolean node_created;
30
public JJTXmlTokenizerState() {
31
nodes = new java.util.ArrayList<Node>();
32
marks = new java.util.ArrayList<Integer>();
37
/* Determines whether the current node was actually closed and
38
pushed. This should only be called in the final user action of a
40
public boolean nodeCreated() {
44
/* Call this to reinitialize the node stack. It is called
45
automatically by the parser's ReInit() method. */
53
/* Returns the root node of the AST. It only makes sense to call
54
this after a successful parse. */
55
public Node rootNode() {
59
/* Pushes a node on to the stack. */
60
public void pushNode(Node n) {
65
/* Returns the node on the top of the stack, and remove it from the
67
public Node popNode() {
69
mk = marks.remove(marks.size()-1);
71
return nodes.remove(nodes.size()-1);
74
/* Returns the node currently on the top of the stack. */
75
public Node peekNode() {
76
return nodes.get(nodes.size()-1);
79
/* Returns the number of children on the stack in the current node
81
public int nodeArity() {
86
public void clearNodeScope(Node n) {
90
mk = marks.remove(marks.size()-1);
94
public void openNodeScope(Node n) {
101
/* A definite node is constructed from a specified number of
102
children. That number of nodes are popped from the stack and
103
made the children of the definite node. Then the definite node
104
is pushed on to the stack. */
105
public void closeNodeScope(Node n, int num) {
106
mk = marks.remove(marks.size()-1);
110
n.jjtAddChild(c, num);
118
/* A conditional node is constructed if its condition is true. All
119
the nodes that have been pushed since the node was opened are
120
made children of the conditional node, which is then pushed
121
on to the stack. If the condition is false the node is not
122
constructed and they are left on the stack. */
123
public void closeNodeScope(Node n, boolean condition) {
126
mk = marks.remove(marks.size()-1);
136
mk = marks.remove(marks.size()-1);
137
node_created = false;
141
/* JavaCC - OriginalChecksum=0e9cbe71823ea05b1e3a7d05f900850d (do not edit this line) */