public final class Action
extends java.lang.Object
It stores the Java code as String together with a priority (line number in the specification).
Modifier and Type | Field and Description |
---|---|
static int |
BACKWARD_ACTION
Action of the backward pass for lookahead
|
static int |
FINITE_CHOICE
Action of a lookahead expression r1/r2 with a finite choice of fixed lengths in r2
|
static int |
FIXED_BASE
Action of a lookahead expression r1/r2 with fixed length r1
|
static int |
FIXED_LOOK
Action of a lookahead expression r1/r2 with fixed length r2
|
static int |
FORWARD_ACTION
Action of the 2nd forward pass for lookahead
|
static int |
GENERAL_LOOK
Action of a general lookahead expression
|
static int |
NORMAL
A normal action
|
Constructor and Description |
---|
Action(int kind)
Creates a new Action object of the specified kind.
|
Action(java.lang.String content,
int priority)
Creates a new Action object with specified content and line number.
|
Modifier and Type | Method and Description |
---|---|
Action |
copyChoice(int length)
copyChoice.
|
boolean |
equals(java.lang.Object o) |
int |
getEntryState()
Return the corresponding entry state for the forward DFA (if this is a general lookahead
expression)
|
Action |
getHigherPriority(Action other)
Compares the priority value of this Action with the specified action.
|
int |
getLookLength()
The length of the lookahead or base if this is a fixed length lookahead action.
|
int |
hashCode()
Calculate hash value.
|
boolean |
isEmittable()
Return true if code for this is action should be emitted, false if it is a BACK/FORWARD
lookahead action.
|
boolean |
isEquiv(Action a)
Returns
true iff the parameter is an Action with the same content as this one. |
boolean |
isGenLookAction()
Return true iff this is action belongs to a general lookahead rule.
|
int |
lookAhead()
Return kind of lookahead.
|
java.lang.String |
lookString()
String representation of the lookahead kind of this action.
|
void |
setEntryState(int entryState)
Set the corresponding entry state for the forward DFA of this action (if this is a general
lookahead expression)
|
void |
setLookAction(int kind,
int data)
Sets the lookahead kind and data for this action
|
java.lang.String |
toString()
Returns the String representation of this object.
|
public static final int NORMAL
public static final int FIXED_BASE
public static final int FIXED_LOOK
public static final int FINITE_CHOICE
public static final int GENERAL_LOOK
public static final int FORWARD_ACTION
public static final int BACKWARD_ACTION
public Action(java.lang.String content, int priority)
content
- java codepriority
- line numberpublic Action(int kind)
kind
- the kind of actionFORWARD_ACTION
,
BACKWARD_ACTION
,
FORWARD_ACTION
,
BACKWARD_ACTION
public Action getHigherPriority(Action other)
other
- the other Action to compare this Action with.public java.lang.String toString()
toString
in class java.lang.Object
public boolean isEquiv(Action a)
true
iff the parameter is an Action with the same content as this one.a
- the object to compare this Action withpublic int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
Test for equality to another object.
This action equals another object if the other object is an equivalent action.
equals
in class java.lang.Object
isEquiv(Action)
public boolean isGenLookAction()
public boolean isEmittable()
public int lookAhead()
public void setLookAction(int kind, int data)
kind
- which kind of lookahead it isdata
- the length for fixed length lookaheads.public int getLookLength()
public int getEntryState()
public void setEntryState(int entryState)
entryState
- a int.public Action copyChoice(int length)
length
- a int.Action
object.public java.lang.String lookString()
Copyright © 1998–2019. All rights reserved.