Package org.htmlunit.javascript.regexp
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 TypeMethodDescriptionvoid
Inserts a string at the current position + offset.void
Inserts a string at the given pos.void
move
(int offset) Moves the current read position by offset.int
read()
Reads the character at the current position and moves the read position by 1.void
remove
(int count) Removes number of chars from the given string.void
Replaces 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
Read the whole tape content.
-