Class Util
java.lang.Object
org.matwoess.jsourceprofiler.tool.instrument.Util
This class contains utility methods for the
ParserState.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic CodePositiongetBlockBegPos(Parser parser, BlockType blockType, boolean isSingleStatement) Returns the block begin position, depending on the block type and whether the block is a single statement.static intgetIncInsertOffset(Parser parser, BlockType blockType, boolean isSingleStatement) Returns the increment insert offset, depending on the block type and whether the block is a single statement.
-
Constructor Details
-
Util
public Util()
-
-
Method Details
-
getBlockBegPos
public static CodePosition getBlockBegPos(Parser parser, BlockType blockType, boolean isSingleStatement) Returns the block begin position, depending on the block type and whether the block is a single statement.It returns either the end position of the current token or the start position of the next token.
- Parameters:
parser- the parser objectblockType- the type of the blockisSingleStatement- whether the block is a single statement- Returns:
- the block begin position
-
getIncInsertOffset
Returns the increment insert offset, depending on the block type and whether the block is a single statement.It returns either 0 or the difference between the end position of the lookahead token and the block begin position.
- Parameters:
parser- the parser objectblockType- the type of the blockisSingleStatement- whether the block is a single statement- Returns:
- the increment insert offset
-