Class RegExpJsToJavaConverter.Tape
java.lang.Object
org.htmlunit.javascript.regexp.RegExpJsToJavaConverter.Tape
- Enclosing class:
RegExpJsToJavaConverter
Helper to encapsulate the transformations.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidInserts a string at the current position + offset.voidInserts a string at the given pos.voidmove(int offset) Moves the current read position by offset.intread()Reads the character at the current position and moves the read position by 1.voidremove(int count) Removes number of chars from the given string.voidReplaces the current char with the given string.toString()Read the whole tape content.
-
Field Details
-
tape_
-
currentPos_
private int currentPos_
-
-
Constructor Details
-
Tape
Tape(String input) Wraps a JavaScript RegExp to access it char by char like a tape.- Parameters:
input- the Javascript RegExp
-
-
Method Details
-
move
public void move(int offset) Moves the current read position by offset.- Parameters:
offset- the move position offset
-
read
public int read()Reads the character at the current position and moves the read position by 1.- Returns:
- the character at current position
-
insert
Inserts a string at the current position + offset.- Parameters:
token- the string to insertoffset- the move position offset
-
insertAt
Inserts a string at the given pos.- Parameters:
token- the string to insertpos- the move position offset
-
replace
Replaces the current char with the given string.- Parameters:
token- the string to insert
-
remove
public void remove(int count) Removes number of chars from the given string.- Parameters:
count- the number of chars to remove
-
toString
-