本文整理汇总了Java中com.sun.org.apache.regexp.internal.RE.offsetNext方法的典型用法代码示例。如果您正苦于以下问题:Java RE.offsetNext方法的具体用法?Java RE.offsetNext怎么用?Java RE.offsetNext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.org.apache.regexp.internal.RE
的用法示例。
在下文中一共展示了RE.offsetNext方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: nodeInsert
import com.sun.org.apache.regexp.internal.RE; //导入方法依赖的package包/类
/**
* Inserts a node with a given opcode and opdata at insertAt. The node relative next
* pointer is initialized to 0.
* @param opcode Opcode for new node
* @param opdata Opdata for new node (only the low 16 bits are currently used)
* @param insertAt Index at which to insert the new node in the program
*/
void nodeInsert(char opcode, int opdata, int insertAt)
{
// Make room for a new node
ensure(RE.nodeSize);
// Move everything from insertAt to the end down nodeSize elements
System.arraycopy(instruction, insertAt, instruction, insertAt + RE.nodeSize, lenInstruction - insertAt);
instruction[insertAt + RE.offsetOpcode] = opcode;
instruction[insertAt + RE.offsetOpdata] = (char)opdata;
instruction[insertAt + RE.offsetNext] = 0;
lenInstruction += RE.nodeSize;
}
示例2: setNextOfEnd
import com.sun.org.apache.regexp.internal.RE; //导入方法依赖的package包/类
/**
* Appends a node to the end of a node chain
* @param node Start of node chain to traverse
* @param pointTo Node to have the tail of the chain point to
*/
void setNextOfEnd(int node, int pointTo)
{
// Traverse the chain until the next offset is 0
int next = instruction[node + RE.offsetNext];
// while the 'node' is not the last in the chain
// and the 'node' is not the last in the program.
while ( next != 0 && node < lenInstruction )
{
// if the node we are supposed to point to is in the chain then
// point to the end of the program instead.
// Michael McCallum <[email protected]>
// FIXME: // This is a _hack_ to stop infinite programs.
// I believe that the implementation of the reluctant matches is wrong but
// have not worked out a better way yet.
if ( node == pointTo ) {
pointTo = lenInstruction;
}
node += next;
next = instruction[node + RE.offsetNext];
}
// if we have reached the end of the program then dont set the pointTo.
// im not sure if this will break any thing but passes all the tests.
if ( node < lenInstruction ) {
// Point the last node in the chain to pointTo.
instruction[node + RE.offsetNext] = (char)(short)(pointTo - node);
}
}
示例3: node
import com.sun.org.apache.regexp.internal.RE; //导入方法依赖的package包/类
/**
* Adds a new node
* @param opcode Opcode for node
* @param opdata Opdata for node (only the low 16 bits are currently used)
* @return Index of new node in program
*/
int node(char opcode, int opdata)
{
// Make room for a new node
ensure(RE.nodeSize);
// Add new node at end
instruction[lenInstruction + RE.offsetOpcode] = opcode;
instruction[lenInstruction + RE.offsetOpdata] = (char)opdata;
instruction[lenInstruction + RE.offsetNext] = 0;
lenInstruction += RE.nodeSize;
// Return index of new node
return lenInstruction - RE.nodeSize;
}