PARSER_BEGIN(XPath)
public class XPath {
boolean isStep = false;
public static void main(String args[]) throws ParseException {
XPath parser = new XPath(System.in);
parser.Input();
}
}
PARSER_END(XPath)
STATIC = false;
LOOKAHEAD = 1;
void Input() :
{}
{
()<EOF>
}
options {
}
TOKEN_MGR_DECLS : {
private Stack stateStack = new Stack();
// private Vector persistentLexStates = new Vector();
static final int PARENMARKER = 2000;
/**
* Push the current state onto the state stack.
*/
private void pushState()
{
// System.err.println("pushing: "+curLexState); printLinePos();
stateStack.addElement(new Integer(curLexState));
}
/**
* Push the given state onto the state stack.
* @param state Must be a valid state.
*/
private void pushState(int state)
{
stateStack.push(new Integer(state));
}
/**
* Pop the state on the state stack, and switch to that state.
*/
private void popState()
{
if (stateStack.size() == 0)
{
printLinePos();
}
int nextState = ((Integer) stateStack.pop()).intValue();
// System.err.println("pop "+nextState); printLinePos();
if(nextState == PARENMARKER)
printLinePos();
SwitchTo(nextState);
}
/**
* Push the given state onto the state stack.
* @param state Must be a valid state.
*/
private boolean isState(int state)
{
for (int i = 0; i < stateStack.size(); i++) {
if(((Integer) stateStack.elementAt(i)).intValue() == state)
{
return true;
}
}
return false;
}
/**
* Push a parenthesis state. This pushes, in addition to the
* lexical state value, a special marker that lets
* resetParenStateOrSwitch(int state)
* know if it should pop and switch. Used for the comma operator.
*/
private void pushParenState(int commaState, int rparState)
{
stateStack.push(new Integer(rparState));
stateStack.push(new Integer(commaState));
stateStack.push(new Integer(PARENMARKER));
SwitchTo(commaState);
}
/**
* Print the current line position.
*/
public void printLinePos()
{
System.err.println("Line: " + input_stream.getEndLine());
}
}
Transition not defined:
Token multiply defined in same state:
<
,
>
MORE
SPECIAL_TOKEN
SKIP
TOKEN
:
{
<
#
:
>
Error! Actions of transitions are not consistent!
{
; }
$action(2):
{
(
lengthOfMatch
)
; }
{
(); }
Error! Next-state of transitions are not consistent!
:
}
<
>
SKIP:
{
< <skip_>>
}
TOKEN :
{
< #skip_ : >
}
~
"
"
("]" "]" ">")
(
)
"
"
["
", "
"]
<EOF>
"
\n
\r
\t
\u
"
[
,
]
"
" - "
"
"\u
" - "\u
"
~
void
()
:
{}
{
}
void () :
{}
{
}
void
void
:
{
}
{
((
) |
)*
(
)
*
*
(
(
)
?
)
|
*
|
}
(
|
(
)
)
[
]
()?
(
)*
(
)+
(
)
<
>
()
LOOKAHEAD()
(
|
)
(<skip_>)+
(<skip_>)*
LOOKAHEAD(
)