JFlex
Class Action
public final class Action
extends java.lang.Object
Encapsulates an action in the specification.
It stores the Java code as String together with a priority (line number in the specification).
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
|
Action(String content, int priority) - Creates a new Action object with specified content and line number.
|
Action(int kind) - Creates a new Action object of the specified kind.
|
Action | copyChoice(int length)
|
boolean | equals(Object o) - Test for equality to another object.
|
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.
|
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
|
String | toString() - Returns the String representation of this object.
|
BACKWARD_ACTION
public static final int BACKWARD_ACTION
Action of the backward pass for lookahead
FINITE_CHOICE
public static final int FINITE_CHOICE
Action of a lookahead expression r1/r2 with a finite choice of
fixed lengths in r2
FIXED_BASE
public static final int FIXED_BASE
Action of a lookahead expression r1/r2 with fixed length r1
FIXED_LOOK
public static final int FIXED_LOOK
Action of a lookahead expression r1/r2 with fixed length r2
FORWARD_ACTION
public static final int FORWARD_ACTION
Action of the 2nd forward pass for lookahead
GENERAL_LOOK
public static final int GENERAL_LOOK
Action of a general lookahead expression
NORMAL
public static final int NORMAL
A normal action
Action
public Action(String content,
int priority)
Creates a new Action object with specified content and line number.
content
- java codepriority
- line number
Action
public Action(int kind)
Creates a new Action object of the specified kind. Only
accepts FORWARD_ACTION or BACKWARD_ACTION.
kind
- the kind of action
copyChoice
public Action copyChoice(int length)
equals
public boolean equals(Object o)
Test for equality to another object.
This action equals another object if the other
object is an equivalent action.
getEntryState
public int getEntryState()
Return the corresponding entry state for the forward DFA (if this
is a general lookahead expression)
- the forward DFA entry state (+1 is the backward DFA)
getHigherPriority
public Action getHigherPriority(Action other)
Compares the priority value of this Action with the specified action.
other
- the other Action to compare this Action with.
- this Action if it has higher priority - the specified one, if not.
getLookLength
public int getLookLength()
The length of the lookahead or base if this is a fixed length
lookahead action.
hashCode
public int hashCode()
Calculate hash value.
- a hash value for this Action
isEmittable
public boolean isEmittable()
Return true if code for this is action should be emitted, false
if it is a BACK/FORWARD lookahead action.
- true if code should be emitted for this action.
isEquiv
public boolean isEquiv(Action a)
Returns true
iff the parameter is an
Action with the same content as this one.
a
- the object to compare this Action with
- true if the action strings are equal
isGenLookAction
public boolean isGenLookAction()
Return true iff this is action belongs to a general lookahead rule.
- true if this actions belongs to a general lookahead rule.
lookAhead
public int lookAhead()
Return kind of lookahead.
lookString
public String lookString()
String representation of the lookahead kind of this action.
- the string representation
setEntryState
public void setEntryState(int entryState)
Set the corresponding entry state for the forward DFA of this action
(if this is a general lookahead expression)
setLookAction
public void setLookAction(int kind,
int data)
Sets the lookahead kind and data for this action
kind
- which kind of lookahead it isdata
- the length for fixed length look aheads.
toString
public String toString()
Returns the String representation of this object.
- string representation of the action