Package net.thebugmc.parser.expression
Class CommentPiece
java.lang.Object
net.thebugmc.parser.util.Pointable
net.thebugmc.parser.expression.ExpressionPiece
net.thebugmc.parser.expression.CommentPiece
Can be inline or multiline, reads until newline or comment end.
Saves piece before comment and goes back to it once comment ends.
-
Constructor Summary
ConstructorsConstructorDescriptionCommentPiece(FilePointer ptr, boolean inline, ExpressionPiece original) Construct a comment piece. -
Method Summary
Modifier and TypeMethodDescriptionread(char c, FilePointer ptr) Parse a character by this piece.replace(FilePointer ptr) Called wheneverPieceResult.REPLACE_LEAVEorPieceResult.REPLACE_TAKEare used.
-
Constructor Details
-
CommentPiece
Construct a comment piece.- Parameters:
ptr- Creation position.inline- Whether this comment piece should stop at newline or at comment end.original- Piece to continue parsing with at the end of comment or null to discard both pieces.
-
-
Method Details
-
read
Description copied from class:ExpressionPieceParse a character by this piece.- Specified by:
readin classExpressionPiece- Parameters:
c- Character to parse.ptr- Character position in file.- Returns:
PieceResult
-
replace
Description copied from class:ExpressionPieceCalled wheneverPieceResult.REPLACE_LEAVEorPieceResult.REPLACE_TAKEare used.- Overrides:
replacein classExpressionPiece- Parameters:
ptr- Position when replace was used.- Returns:
- Another piece to continue parsing with, or null to discard current piece.
-